def test_player_start_turn(self): timer = MockTimer() chess = MockChess() player = Player(WHITE, timer, chess) player.start_turn() self.assertEqual(player.state, SELECT) self.assertEqual(timer.turn_started, True)
def test_player_play(self): chess = MockChess() player = Player(WHITE, MockTimer(), chess) self.assertEqual(player.play((0, 0)), False) self.assertEqual(chess.played, False) player.select((1, 1)) self.assertEqual(player.play((1, 2)), True) self.assertEqual(chess.played, True)
def test_player_end_turn(self): timer = MockTimer() chess = MockChess() player = Player(WHITE, timer, chess) player.start_turn() player.end_turn() self.assertEqual(player.state, None) self.assertEqual(timer.turn_ended, True)
def test_player_select(self): chess = MockChess() player = Player(WHITE, MockTimer(), chess) player.select((0, 0)) self.assertEqual(chess.selected, (0, 0))
def test_player_lose(self): chess = MockChess() player = Player(WHITE, MockTimer(), chess) player.lose() self.assertEqual(chess.winner, BLACK)