本文整理汇总了Python中the_tale.game.logic_storage.LogicStorage.process_turn__single_hero方法的典型用法代码示例。如果您正苦于以下问题:Python LogicStorage.process_turn__single_hero方法的具体用法?Python LogicStorage.process_turn__single_hero怎么用?Python LogicStorage.process_turn__single_hero使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类the_tale.game.logic_storage.LogicStorage
的用法示例。
在下文中一共展示了LogicStorage.process_turn__single_hero方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LogicStorageTests
# 需要导入模块: from the_tale.game.logic_storage import LogicStorage [as 别名]
# 或者: from the_tale.game.logic_storage.LogicStorage import process_turn__single_hero [as 别名]
#.........这里部分代码省略.........
self.assertEqual(save_hero_data.call_count, 2)
@mock.patch('the_tale.game.heroes.conf.heroes_settings.DUMP_CACHED_HEROES', True)
def test_process_turn__switch_caches(self):
self.assertEqual(self.storage.previous_cache, {})
self.assertEqual(self.storage.current_cache, {})
self.storage.process_turn()
self.storage.save_changed_data()
self.assertEqual(self.storage.previous_cache, {})
self.assertNotEqual(self.storage.current_cache, {})
old_cache = self.storage.current_cache
self.storage.process_turn()
self.storage.save_changed_data()
self.assertEqual(self.storage.previous_cache, old_cache)
self.assertNotEqual(self.storage.current_cache, old_cache)
def test_process_turn_single_hero__runned_outside_storage(self):
action_1 = actions_prototypes.ActionRegenerateEnergyPrototype.create(hero=self.hero_1)
action_1.state = action_1.STATE.PROCESSED
action_2 = actions_prototypes.ActionMoveToPrototype.create(hero=self.hero_1, destination=self.p1)
action_2.state = action_2.STATE.PROCESSED
action_3 = actions_prototypes.ActionInPlacePrototype.create(hero=self.hero_1)
action_3.state = action_3.STATE.PROCESSED
self.assertEqual(self.hero_1.actions.number, 4)
self.storage.process_turn__single_hero(hero=self.hero_1,
logger=None,
continue_steps_if_needed=True)
self.assertEqual(self.hero_1.actions.number, 2)
self.assertEqual(self.hero_1.actions.current_action.TYPE, actions_prototypes.ActionQuestPrototype.TYPE)
self.storage.process_turn() # just nothing was broken
def test_process_turn__process_action_chain(self):
action_1 = actions_prototypes.ActionRegenerateEnergyPrototype.create(hero=self.hero_1)
action_1.state = action_1.STATE.PROCESSED
action_2 = actions_prototypes.ActionMoveToPrototype.create(hero=self.hero_1, destination=self.p1)
action_2.state = action_2.STATE.PROCESSED
action_3 = actions_prototypes.ActionInPlacePrototype.create(hero=self.hero_1)
action_3.state = action_3.STATE.PROCESSED
self.assertEqual(self.hero_1.actions.number, 4)
self.storage.process_turn()
self.assertEqual(self.hero_1.actions.number, 2)
self.assertEqual(self.hero_1.actions.current_action.TYPE, actions_prototypes.ActionQuestPrototype.TYPE)
@mock.patch('the_tale.game.heroes.conf.heroes_settings.DUMP_CACHED_HEROES', False)
def test_process_turn__without_dump(self):
self.assertEqual(self.storage.skipped_heroes, set())
self.storage.process_turn()
self.assertEqual(self.storage.skipped_heroes, set())