Пример #1
0
 def it_saves_covenant():
     from src.covenant import save_covenant
     cov = Covenant()
     cov.inflation = 100
     cov.covenfolken.add_covenfolk("Barg", "magi")
     cov.covenfolken.add_covenfolk("le", "dependant")
     cov.armory.add_equipment("earthquake machine", "heavy siege", "expensive")
     cov.laboratories.add_lab("Haunted mansion")
     save_covenant(cov, "cov.json")
     with open("cov.json", "r+") as f:
         cov_json = f.readlines()
         # TODO: find a better way to assert this succeeds without using load
         assert len(cov_json) > 1
Пример #2
0
 def it_loads_covenant():
     from src.covenant import save_covenant, load_covenant_from_file
     cov = Covenant()
     cov.inflation = 100
     cov.covenfolken.add_covenfolk("Barg", "magi")
     cov.covenfolken.add_covenfolk("le", "dependant")
     cov.armory.add_equipment("earthquake machine", "heavy siege", "expensive")
     cov.laboratories.add_lab("Haunted mansion")
     save_covenant(cov, "cov.json")
     loaded = load_covenant_from_file("cov.json")
     assert loaded.covenfolken.covenfolk["Barg"]
     assert loaded.armory.heavy_siege["earthquake machine"] == {"expensive": 1}
     assert loaded.armory.weapons["pistol"] == {}
     assert loaded.laboratories.labs["Haunted mansion"].size == 0
     assert loaded.expenses == 9999999
Пример #3
0
 def it_does_not_increase_inflation_if_expenses_lowered():
     cov = Covenant()
     cov.inflation = 5
     assert cov.calculate_inflation(300, 150) == 5
Пример #4
0
 def it_correctly_calculates_inflation():
     cov = Covenant()
     cov.inflation = 0
     assert cov.calculate_inflation(100, 200) == 2