def test_rook_checkmate(self): """ Test that a rook will put a king of the opposite color in checkmate :return: """ board = ChessBoard(empty_board=True) board['a3'] = King(Color.white) board['a5'] = Rook(Color.black) board['b8'] = Rook(Color.black) self.assertTrue(board.is_checkmate(Color.white), 'King should be in checkmate')
def test_bishop_checkmate(self): """ Test that a queen will put a king of the opposite color in checkmate :return: """ board = ChessBoard(empty_board=True) board['a8'] = King(Color.white) board['a6'] = Knight(Color.black) board['b6'] = King(Color.black) board['c6'] = Bishop(Color.black) self.assertTrue(board.is_checkmate(Color.white), 'King should be in checkmate')
def test_pawn_checkmate(self): """ Test that a pawn will put a king of the opposite color in checkmate :return: """ board = ChessBoard(empty_board=True) board['a1'] = King(Color.white) board['a2'] = Pawn(Color.white) board['b1'] = Bishop(Color.white) board['b2'] = Pawn(Color.black) board['c3'] = Pawn(Color.black) self.assertTrue(board.is_checkmate(Color.white), 'King should be in checkmate')
def test_queen_checkmate(self): """ Test that a queen will put a king of the opposite color in checkmate :return: """ board = ChessBoard(empty_board=True) board['d6'] = King(Color.black) board['c5'] = Pawn(Color.black) board['e5'] = Pawn(Color.black) board['a5'] = Bishop(Color.white) board['d5'] = Queen(Color.white) board['d2'] = Rook(Color.white) board['g6'] = Knight(Color.white) self.assertTrue(board.is_checkmate(Color.black), 'King should be in checkmate')