import unittest from test.chess_ffi import Board from test.chess_ffi import KING_ATTACKS from test.chess_ffi import KNIGHT_ATTACKS from test.chess_ffi import PAWN_ATTACKS from test.chess_ffi import gen_moves from test.chess_ffi import init_attack_caches from test.chess_ffi import load_fen class ChessLibTestBase(unittest.TestCase): @classmethod def setUpClass(cls): init_attack_caches() cls.KNIGHT_ATTACKS = KNIGHT_ATTACKS cls.KING_ATTACKS = KING_ATTACKS cls.PAWN_ATTACKS = PAWN_ATTACKS def setUp(self): # This should be an empty board for each test in the suite. self.board = Board() def load_fen(self, fen, board=None): if board: return load_fen(board, fen) return load_fen(self.board, fen) def gen(self, captures_only: bool = False, cap: int = 256): return gen_moves(self.board, captures_only=captures_only, cap=cap)