Skip to content

Commit

Permalink
Update test_external_moves.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AttackingOrDefending authored Jan 7, 2025
1 parent b5c7bb6 commit 3ac44a5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test_bot/test_external_moves.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,24 @@ def online_book_get() -> OnlineType:

return online_book_get()

def is_chessdb_cn_up(self):
def is_chessdb_cn_up(self) -> bool:
"""Check if chessdb.cn is up."""
try:
self.other_session.get("https://www.chessdb.cn/cdb.php", timeout=2)
return True
except RequestException:
return False

def is_lichess_ovh_up(self):
def is_lichess_ovh_up(self) -> bool:
"""Check if tablebase.lichess.ovh is up."""
try:
self.other_session.get("https://tablebase.lichess.ovh/standard", timeout=2)
return True
except RequestException:
return False

def is_lichess_org_up(self):
def is_lichess_org_up(self) -> bool:
"""Check if lichess.org is up."""
try:
self.other_session.get("https://lichess.org/api/cloud-eval", timeout=2)
return True
Expand Down Expand Up @@ -176,7 +179,8 @@ def test_external_moves() -> None:
wdl1_move = get_online_move_wrapper(li, chess.Board(endgame_wdl1_fen), game, online_cfg, draw_or_resign_cfg)
assert not wdl1_move.resigned and not wdl1_move.draw_offered
# Test with reversed colors.
assert get_online_move_wrapper(li, chess.Board(endgame_wdl2_fen).mirror(), game, online_cfg, draw_or_resign_cfg).resigned
assert get_online_move_wrapper(li, chess.Board(endgame_wdl2_fen).mirror(), game, online_cfg,
draw_or_resign_cfg).resigned
assert get_online_move_wrapper(li, chess.Board(endgame_wdl0_fen).mirror(), game, online_cfg,
draw_or_resign_cfg).draw_offered
wdl1_move = get_online_move_wrapper(li, chess.Board(endgame_wdl1_fen).mirror(), game, online_cfg, draw_or_resign_cfg)
Expand Down

0 comments on commit 3ac44a5

Please sign in to comment.