# tests/test_core_speak.py """Plan 4, tâche 4 — bench/core_speak.py : l'évaluation honnête du noyau réel. Le test charge le VRAI checkpoint fractus (chargement strict, greedy court) : skippé sans torch (substrat mingw), skippé si le checkpoint est absent. Le contrat mesuré est le harnais honnête (runs verbatim + taux), pas la qualité du texte — le checkpoint actuel est de la salade de mots et le test l'accepte. """ import pytest torch = pytest.importorskip("torch", reason="core_speak nécessite torch") from bench.core_speak import run_core_speak def test_core_speak_reports_honestly(tmp_path): import pathlib ckpt = pathlib.Path(r"C:\Users\PHIL\ZCodeProject\fractus\checkpoints\checkpoints\fractus_1b_latest.pt") if not ckpt.exists(): pytest.skip("checkpoint absent") result = run_core_speak(ckpt, ["what is the capital of france"], brain=None, max_new_tokens=6) assert len(result["runs"]) == 1 run = result["runs"][0] for key in ("question", "no_cards_output", "with_cards_output", "answer_in_output"): assert key in run assert isinstance(result["with_cards_answer_rate"], float)