"""Local writing-profile compilation. Run from backend/: python tests/test_writing_profile.py""" from __future__ import annotations import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(ROOT)) from writing_profile_store import compile_style_signals def expect(ok: bool, message: str) -> None: if not ok: raise SystemExit(f"FAIL: {message}") print(f"OK {message}") def main() -> None: empty = compile_style_signals(["ok"]) expect(empty == "", "too little text yields no signals") clocks = compile_style_signals( ["Heute um 7:30 Uhr bin ich zum Markt. Danach habe ich Kirschen gekauft."] ) expect("Uhrzeiten" in clocks, "clocks become a form hint") expect("keine Diagnose" in clocks, "signals refuse diagnosis language") expect("chronologisch" in clocks, "time words mark chronology") reflect = compile_style_signals( [ "Der Vormittag war ruhig. Allerdings wunderte ich mich. " "Vielleicht bedeutet das weniger, als es scheint." ] ) expect("Einordnung" in reflect, "reflection markers are form, not a self model") expect( "keine Diagnose" in compile_style_signals( ["Heute war der Markt voll. Ich bin früh gegangen und habe Kirschen gekauft."] ), "first-day signals exist without a saved entry", ) print("writing profile signals ok") if __name__ == "__main__": main()