def test_to_json(self): game = Game() self.assertDictEqual( game.to_json(), { "whose_turn": None, "grid": [BoxType.empty] * Game.grid_size * Game.grid_size, "winner": None, "status": GameStatus.awaiting, }, )
async def publish_game_state(game: Game) -> None: payload = {"data": {"event": "game_state", "payload": game.to_json()}} await publish(payload, game.players)