def test_is_board_complete_false(self): self.game['board'] = [ ["X", "O", "O"], ["O", "-", "-"], ["O", "X", "O"], ] self.assertFalse(_board_is_full(self.game['board']))
def test_is_board_complete(self): self.game['board'] = [ ["X", "O", "O"], ["O", "X", "X"], ["O", "X", "O"], ] self.assertTrue(_board_is_full(self.game['board']))
def test_play_no_winner_large(self): # [ # ["X", "O", "X", "O"], # ["O", "O", "X", "O"], # ["X", "X", "O", "X"], # ["X", "X", "O", "O"], # ] move(self.game_large, self.x, position=(0, 0)) move(self.game_large, self.o, position=(0, 1)) move(self.game_large, self.x, position=(0, 2)) move(self.game_large, self.o, position=(1, 0)) move(self.game_large, self.x, position=(1, 2)) move(self.game_large, self.o, position=(1, 1)) move(self.game_large, self.x, position=(2, 0)) move(self.game_large, self.o, position=(2, 2)) move(self.game_large, self.x, position=(2, 3)) move(self.game_large, self.o, position=(0, 3)) move(self.game_large, self.x, position=(3, 1)) move(self.game_large, self.o, position=(1, 3)) move(self.game_large, self.x, position=(3, 0)) move(self.game_large, self.o, position=(3, 3)) move(self.game_large, self.x, position=(3, 2)) with self.assertRaisesRegexp(GameOver, 'Game is tied!'): move(self.game_large, self.o, position=(2, 1)) self.assertEqual(get_winner(self.game_large), None) self.assertTrue(_board_is_full(self.game_large['board'])) with self.assertRaisesRegexp(InvalidMovement, 'Game is over.'): move(self.game_large, self.x, position=(0, 0))
def test_play_no_winner(self): # [ # ["X", "O", "X"], # ["O", "O", "X"], # ["X", "X", "O"], # ] move(self.game, self.x, position=(0, 0)) move(self.game, self.o, position=(0, 1)) move(self.game, self.x, position=(0, 2)) move(self.game, self.o, position=(1, 0)) move(self.game, self.x, position=(1, 2)) move(self.game, self.o, position=(1, 1)) move(self.game, self.x, position=(2, 0)) move(self.game, self.o, position=(2, 2)) with self.assertRaisesRegexp(GameOver, 'Game is tied!'): move(self.game, self.x, position=(2, 1)) self.assertEqual(get_winner(self.game), None) self.assertTrue(_board_is_full(self.game['board'])) with self.assertRaisesRegexp(InvalidMovement, 'Game is over.'): move(self.game, self.o, position=(0, 0))