예제 #1
0
class TestCaseCheckPath(unittest.TestCase):
    def test_get_path(self):
        self.b = ChessBoard()

        # check path for a white bishop (C1) -> (E3), blocked by own pawn
        self.assertFalse(self.b._check_path([7, 2], [-1, 1], [5, 4]))

        # move black pawn and later white pawn as well as check path for same knight
        self.b.move('d2', 'd4')
        self.assertTrue(self.b._check_path([7, 2], [-1, 1], [5, 4]))

        # check path for white pawn (C3) -> (C5), no obstacles
        self.assertTrue(self.b._check_path([6, 2], [-1, 0], [4, 2]))