Example #1
0
def test_used_king_ok():
    """test_positions_used_from_for_king_in_the_upper_corner_are_valid"""
    king_piece = King()
    small_board = Board(3, 3)
    assert (0, 0) in king_piece.positions_to_take(small_board, 0, 0)
    assert (1, 0) in king_piece.positions_to_take(small_board, 0, 0)
    assert (1, 1) in king_piece.positions_to_take(small_board, 0, 0)
    assert (0, 1) in king_piece.positions_to_take(small_board, 0, 0)
    assert (0, 2) not in king_piece.positions_to_take(small_board, 0, 0)
Example #2
0
def test_king_takes_rook():
    """test_of_a_bug_it_was_possible_to_put_a_king_that_takes_a_rook"""
    king = King()
    board = Board(3, 3)
    board.put(king, 0, 0)
    positions_to_take = king.positions_to_take(board, 0, 0)
    assert (0, 1) in positions_to_take