3 Commits

Author SHA1 Message Date
cclecle
82f8feb884 fix unittest import for coverage 2023-07-23 14:48:29 +01:00
cclecle
7a2eb6db47 fix linux path style
fix missing directory in testfiles
2023-07-23 13:55:19 +01:00
cclecle
95daa73463 fix: wrong commented out line 2023-07-23 13:48:48 +01:00
3 changed files with 14 additions and 14 deletions

View File

@@ -133,25 +133,25 @@ class SOTFSaveThune:
def resuscitate_virginia(self) -> None:
self.open_last_save()
nestedjson = json.loads(self.lastGameStateSaveData["Data"]["GameState"])
if "IsVirginiaDead" in nestedjson:
#print(nestedjson["IsVirginiaDead"])
# if "IsVirginiaDead" in nestedjson:
# print(nestedjson["IsVirginiaDead"])
nestedjson["IsVirginiaDead"] = False
#print(nestedjson["IsVirginiaDead"])
# print(nestedjson["IsVirginiaDead"])
self.lastGameStateSaveData["Data"]["GameState"] = json.dumps(nestedjson)
nestedjson = json.loads(self.lastSaveData["Data"]["VailWorldSim"])
#print(nestedjson["Actors"])
# print(nestedjson["Actors"])
Virginia = [_ for _ in nestedjson["Actors"] if _["TypeId"] == 10][0]
#print(Virginia)
# print(Virginia)
if "PlayerKilled" in Virginia and Virginia["PlayerKilled"] == True:
del Virginia["PlayerKilled"]
Virginia["FamilyId "] = 0
Virginia["State "] = 2
Virginia["Stats"] = {"Health": 100, "Anger": 0, "Fear": 0, "Fullness": 44, "Hydration": 16, "Energy": 100, "Affection": 50}
Virginia["StateFlags "] = 0
#print(nestedjson["Actors"])
# print(nestedjson["Actors"])
self.lastSaveData["Data"]["VailWorldSim"] = json.dumps(nestedjson)
self.save_last_save()

View File

@@ -14,32 +14,32 @@ from contextlib import redirect_stdout, redirect_stderr
print(__name__)
print(__package__)
from src import sotffixcompanions
from src.sotffixcompanions import SOTFSaveThune, __version__, SOTFSaveThune_Exception_SaveNotFound
testdir_path = Path(__file__).parent.resolve()
class TestSOTF(unittest.TestCase):
def test_version(self):
self.assertNotEqual(sotffixcompanions.__version__, "?.?.?")
self.assertNotEqual(__version__, "?.?.?")
def test_SOTFSaveThune_searchlastsave(self):
testSOTF = sotffixcompanions.SOTFSaveThune(testdir_path / "testfiles\\Saves")
testSOTF = SOTFSaveThune(testdir_path / "testfiles" / "Saves")
testSOTF.search_last_save()
def test_SOTFSaveThune_SaveNotFound(self):
testSOTF = sotffixcompanions.SOTFSaveThune(testdir_path / "testfiles\\NoSaves")
with self.assertRaises(sotffixcompanions.SOTFSaveThune_Exception_SaveNotFound):
testSOTF = SOTFSaveThune(testdir_path / "testfiles" / "NoSaves")
with self.assertRaises(SOTFSaveThune_Exception_SaveNotFound):
testSOTF.open_last_save()
def test_SOTFSaveThune_openlastsave(self):
testSOTF = sotffixcompanions.SOTFSaveThune(testdir_path / "testfiles\\Saves")
testSOTF = SOTFSaveThune(testdir_path / "testfiles" / "Saves")
testSOTF.open_last_save()
def test_SOTFSaveThune_resuscitate_kelvin(self):
testSOTF = sotffixcompanions.SOTFSaveThune(testdir_path / "testfiles\\Saves")
testSOTF = SOTFSaveThune(testdir_path / "testfiles" / "Saves")
testSOTF.resuscitate_kelvin()
def test_SOTFSaveThune_resuscitate_virginia(self):
testSOTF = sotffixcompanions.SOTFSaveThune(testdir_path / "testfiles\\Saves")
testSOTF = SOTFSaveThune(testdir_path / "testfiles" / "Saves")
testSOTF.resuscitate_virginia()

View File