Skip to content

Commit c100a37

Browse files
authored
add test cases (very little)
1 parent 4b0c56d commit c100a37

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,6 +1720,18 @@ def test_impossible_check_due_to_en_passant(self):
17201720
self.assertFalse(board.has_legal_en_passant())
17211721
self.assertEqual(len(list(board.legal_moves)), 2)
17221722

1723+
def test_multiple_kings(self):
1724+
board = chess.Board("KKKK1kkk/8/8/8/8/8/8/8 w - - 0 1")
1725+
self.assertEqual(board.king(chess.WHITE), None)
1726+
1727+
# https://github.com/niklasf/python-chess/issues/1169#issuecomment-3838025276
1728+
board = chess.Board(None)
1729+
board.set_piece_at(chess.A1, chess.Piece(chess.ROOK, chess.WHITE))
1730+
board.set_piece_at(chess.A8, chess.Piece(chess.KING, chess.BLACK)) # attacked
1731+
board.set_piece_at(chess.H8, chess.Piece(chess.KING, chess.BLACK)) # safe
1732+
board.turn = chess.WHITE
1733+
self.assertTrue(board.was_into_check())
1734+
17231735

17241736
class LegalMoveGeneratorTestCase(unittest.TestCase):
17251737

0 commit comments

Comments
 (0)