本文整理汇总了Python中GameState.GameState.add_stage方法的典型用法代码示例。如果您正苦于以下问题:Python GameState.add_stage方法的具体用法?Python GameState.add_stage怎么用?Python GameState.add_stage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameState.GameState
的用法示例。
在下文中一共展示了GameState.add_stage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: from GameState import GameState [as 别名]
# 或者: from GameState.GameState import add_stage [as 别名]
class TestGameState:
def setup(self):
self.game_state = GameState()
self.game_state.stages = []
def teardown(self):
self.game_state = None
def test_add_stage(self):
assert len(self.game_state.stages) == 0
self.game_state.add_stage("test stage")
assert len(self.game_state.stages) == 1
def test_advance(self):
assert self.game_state.current_stage_id == 0
self.game_state.advance()
assert self.game_state.current_stage_id == 1
def test_game_loop(self):
stage = Mock()
stage.all_requirements_satisfied = Mock(return_value=True)
self.game_state.add_stage(stage)
self.game_state.game_loop()
assert stage.perform_actions.called