def test_moves_blocked_ally(self): rook = Rook(self.white, (0, 0)) king = King(self.white, (0, 1)) self.board.add_piece(rook) self.board.add_piece(king) moves = list(rook.moves(self.board)) self.assertEquals(len(moves), 7, moves)
def test_moves_blocked_enemy(self): rook = Rook(self.white, (0, 0)) knight = Knight(self.black, (0, 1)) self.board.add_piece(rook) self.board.add_piece(knight) moves = list(rook.moves(self.board)) self.assertEquals(len(moves), 8, moves)
def test_moves_corner(self): king = King(self.white, (3, 3)) rook = Rook(self.white, (0, 0)) self.board.add_piece(king) self.board.add_piece(rook) moves = list(rook.moves(self.board)) self.assertEquals(len(moves), 14, moves)