Save the inventory of the player when saving the game, fixes #33
This commit is contained in:
@ -32,6 +32,9 @@ class TestGame(unittest.TestCase):
|
||||
"""
|
||||
Save a game and reload it.
|
||||
"""
|
||||
bomb = Bomb()
|
||||
self.game.map.add_entity(bomb)
|
||||
bomb.hold(self.game.player)
|
||||
old_state = self.game.save_state()
|
||||
|
||||
self.game.handle_key_pressed(KeyValues.DOWN)
|
||||
@ -45,6 +48,9 @@ class TestGame(unittest.TestCase):
|
||||
new_state = self.game.save_state()
|
||||
self.assertEqual(old_state, new_state)
|
||||
|
||||
# Ensure that the bomb is loaded
|
||||
self.assertTrue(self.game.player.inventory)
|
||||
|
||||
# Error on loading save
|
||||
with open(ResourceManager.get_config_path("save.json"), "w") as f:
|
||||
f.write("I am not a JSON file")
|
||||
|
Reference in New Issue
Block a user