本文整理汇总了Python中server.games.game.Game.id方法的典型用法代码示例。如果您正苦于以下问题:Python Game.id方法的具体用法?Python Game.id怎么用?Python Game.id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类server.games.game.Game
的用法示例。
在下文中一共展示了Game.id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_report_army_stats_sends_stats_for_defeated_player
# 需要导入模块: from server.games.game import Game [as 别名]
# 或者: from server.games.game.Game import id [as 别名]
async def test_report_army_stats_sends_stats_for_defeated_player(game: Game):
game.id = 43
game.state = GameState.LOBBY
players = [
Player(id=1, login='Dostya', global_rating=(1500, 500)),
Player(id=2, login='Rhiza', global_rating=(1500, 500))
]
add_connected_players(game, players)
await game.launch()
await game.add_result(0, 1, 'defeat', -1)
with open("tests/data/game_stats_simple_win.json", "r") as stats_file:
stats = stats_file.read()
await game.report_army_stats(stats)
game._game_stats_service.process_game_stats.assert_called_once_with(players[1], game, stats)
示例2: test_players_exclude_observers
# 需要导入模块: from server.games.game import Game [as 别名]
# 或者: from server.games.game.Game import id [as 别名]
async def test_players_exclude_observers(game: Game):
game.id = 44
game.state = GameState.LOBBY
players = [
Player(id=1, login='Dostya', global_rating=(1500, 500)),
Player(id=2, login='Rhiza', global_rating=(1500, 500)),
]
add_connected_players(game, players)
obs = Player(id=3, login='Zoidberg', global_rating=(1500, 500))
game.game_service.player_service[obs.id] = obs
gc = game_connection(state=GameConnectionState.CONNECTED_TO_HOST, player=obs)
game.set_player_option(obs.id, 'Army', -1)
game.set_player_option(obs.id, 'StartSpot', -1)
game.set_player_option(obs.id, 'Team', 0)
game.set_player_option(obs.id, 'Faction', 0)
game.set_player_option(obs.id, 'Color', 0)
game.add_game_connection(gc)
await game.launch()
assert game.players == frozenset(players)