rewrite: TS monorepo — pi SDK stateless agents, Postgres+pg-boss, SvelteKit themed UI; legacy moved to legacy/
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
from ai_chess.prompts import build_system_prompt, build_first_prompt, build_turn_prompt, WATCHDOG_NUDGE
|
||||
from ai_chess.sides import Side
|
||||
|
||||
|
||||
def test_system_prompt_mentions_opponent_and_toxicity():
|
||||
sp = build_system_prompt(side=Side.WHITE, opponent_name="codex", opponent_model="gpt-5.5")
|
||||
assert "codex" in sp
|
||||
assert "gpt-5.5" in sp
|
||||
assert "грубо" in sp or "трэш" in sp or "троллить" in sp
|
||||
assert "русск" in sp.lower()
|
||||
assert "move(" in sp
|
||||
assert "resign" in sp
|
||||
assert "offer_draw" in sp
|
||||
|
||||
|
||||
def test_first_prompt_white():
|
||||
p = build_first_prompt(side=Side.WHITE, fen="startfen", ascii_board="...board...", opponent_san=None, opponent_comment=None)
|
||||
assert "белыми" in p.lower() or "белые" in p.lower()
|
||||
assert "startfen" in p
|
||||
assert "...board..." in p
|
||||
|
||||
|
||||
def test_first_prompt_black_includes_white_move():
|
||||
p = build_first_prompt(side=Side.BLACK, fen="f", ascii_board="b", opponent_san="e4", opponent_comment="готовься")
|
||||
assert "чёрн" in p.lower() or "черн" in p.lower()
|
||||
assert "e4" in p
|
||||
assert "готовься" in p
|
||||
|
||||
|
||||
def test_turn_prompt_includes_san_and_comment():
|
||||
p = build_turn_prompt(opponent_san="Nf3", opponent_comment="трясись", fen="f", ascii_board="b", pending_draw_from_opponent=False)
|
||||
assert "Nf3" in p
|
||||
assert "трясись" in p
|
||||
|
||||
|
||||
def test_turn_prompt_with_draw_offer():
|
||||
p = build_turn_prompt(opponent_san="e5", opponent_comment=None, fen="f", ascii_board="b", pending_draw_from_opponent=True)
|
||||
assert "ничь" in p.lower()
|
||||
assert "accept_draw" in p
|
||||
|
||||
|
||||
def test_watchdog_nudge_constant():
|
||||
assert "move" in WATCHDOG_NUDGE
|
||||
Reference in New Issue
Block a user