def test_reloading_game_with_custom_kb(): twl = KnowledgeBase.default().logic._document twl += """ type customobj : o { inform7 { type { kind :: "custom-obj-like"; } } } """ logic = GameLogic.parse(twl) options = GameOptions() options.kb = KnowledgeBase(logic, "") M = GameMaker(options) room = M.new_room("room") M.set_player(room) custom_obj = M.new(type='customobj', name='customized object') M.inventory.add(custom_obj) commands = ["drop customized object"] quest = M.set_quest_from_commands(commands) assert quest.commands == tuple(commands) game = M.build() assert game == Game.deserialize(game.serialize())
def test_serialization(self): data = self.game.serialize() game2 = Game.deserialize(data) assert self.game == game2 assert self.game.metadata == game2.metadata
def test_serialization(self): data = self.game.serialize() game = Game.deserialize(data) assert game == self.game assert id(game) != id(self.game) assert game.metadata == self.game.metadata