def test_is_winner(self): game = Game() game.grid = [ BoxType.nought, BoxType.cross, BoxType.cross, BoxType.nought, BoxType.empty, BoxType.empty, BoxType.nought, BoxType.empty, BoxType.empty, ] self.assertTrue(game.is_winner) game.grid = [ BoxType.nought, BoxType.cross, BoxType.cross, BoxType.nought, BoxType.nought, BoxType.empty, BoxType.cross, BoxType.nought, BoxType.cross, ] self.assertFalse(game.is_winner)
def test_bo_is_not_empty_validation(self): game = Game() game.grid = [BoxType.nought] * Game.grid_size * Game.grid_size with self.assertRaises(SchemaError) as error: WebsocketHandler.validate_request( json.dumps({ "operation": "turn", "payload": { "turn": 0, }, }), game, ) self.assertEqual(error.exception.code, "Box is not empty. Try again.")