def test__finally_move(self): board = ChessBoard() selected_figure = Point(3, 6) new_position = Point(3, 4) board._finally_move(new_position, selected_figure) self.assertEqual(board.get_figure_from_board(new_position), "wp")
def test_clean_cell_after_get_or_move_figure(self): board = ChessBoard() cell_to_clean = Point(1, 1) board.clean_cell(cell_to_clean) self.assertEqual(board.get_figure_from_board(cell_to_clean), " ")
def test_get_figure_from_board(self): board = ChessBoard() blackPawn = board.get_figure_from_board(Point(1, 1)) whiteRock = board.get_figure_from_board(Point(7, 7)) blackBishop = board.get_figure_from_board(Point(5, 0)) whiteQueen = board.get_figure_from_board(Point(3, 7)) whiteSpace = board.get_figure_from_board(Point(4, 4)) self.assertEqual(blackPawn, "bp") self.assertEqual(whiteRock, "wr") self.assertEqual(blackBishop, "bb") self.assertEqual(whiteQueen, "wq") self.assertEqual(whiteSpace, " ") self.assertNotEqual(blackPawn, "wp") self.assertNotEqual(blackBishop, "wb") self.assertNotEqual(whiteQueen, " ")
def test_make_a_promotion_of_queen(self): board = ChessBoard() testBoard = [['br', 'bn', 'bb', 'bq', 'bk', 'bb', 'wp', 'br'], ['bp', 'bp', 'bp', 'bp', 'bp', 'bp', ' ', 'bp'], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '], ['wp', 'wp', 'wp', 'wp', 'wp', 'wp', ' ', 'wp'], ['wr', 'wn', 'wb', 'wq', 'wk', 'wb', 'wn', 'wr']] set_board(board, testBoard) # Test 1 selected_figure = Point(6, 0) self.assertEqual(board.get_figure_from_board(selected_figure), "wp") # Test 2 board._promotion_queen(selected_figure, "wq") self.assertEqual(board.get_figure_from_board(selected_figure), "wq")