本文整理汇总了Python中server.games.game.Game.on_game_end方法的典型用法代码示例。如果您正苦于以下问题:Python Game.on_game_end方法的具体用法?Python Game.on_game_end怎么用?Python Game.on_game_end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类server.games.game.Game
的用法示例。
在下文中一共展示了Game.on_game_end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_initialized_game_not_allowed_to_end
# 需要导入模块: from server.games.game import Game [as 别名]
# 或者: from server.games.game.Game import on_game_end [as 别名]
async def test_initialized_game_not_allowed_to_end(game: Game):
await game.clear_data()
game.state = GameState.INITIALIZING
game.on_game_end()
assert game.state is GameState.INITIALIZING
示例2: test_game_end_when_no_more_connections
# 需要导入模块: from server.games.game import Game [as 别名]
# 或者: from server.games.game.Game import on_game_end [as 别名]
async def test_game_end_when_no_more_connections(game: Game, mock_game_connection):
game.state = GameState.LOBBY
game.on_game_end = CoroMock()
mock_game_connection.state = GameConnectionState.CONNECTED_TO_HOST
game.add_game_connection(mock_game_connection)
await game.remove_game_connection(mock_game_connection)
game.on_game_end.assert_any_call()