Fix attack to tests

This commit is contained in:
2025-08-22 14:28:48 -04:00
parent f3b6b7448e
commit 5ddb359675
3 changed files with 52 additions and 54 deletions

View File

@@ -1,4 +1,5 @@
import unittest
from binding.python_c_ffi import ChessFFI
from test.chess_ffi import Board
from test.chess_ffi import KING_ATTACKS
from test.chess_ffi import KNIGHT_ATTACKS
@@ -11,6 +12,9 @@ from test.chess_ffi import load_fen
class ChessLibTestBase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.chess_ffi = ChessFFI()
init_attack_caches()
cls.KNIGHT_ATTACKS = KNIGHT_ATTACKS
@@ -25,8 +29,8 @@ class ChessLibTestBase(unittest.TestCase):
def load_fen(self, fen, board=None):
if board:
return load_fen(board, fen)
return load_fen(self.board, fen)
return self.chess_ffi.load_fen(board, fen)
return self.chess_ffi.load_fen(self.board, fen)
def gen(self, captures_only: bool = False, cap: int = 256):