"""Prüft normalize_numbers: Einheiten/Uhrzeiten/Dezimalzahlen verbalisieren, Modellnummern schützen.""" from text_norm import normalize_numbers as N def check(name, text, must_have=(), must_not=()): out = N(text) ok = all(h in out for h in must_have) and all(x not in out for x in must_not) print(f"{'PASS' if ok else 'FAIL'} {name}: \"{text}\" -> \"{out}\"") return ok allok = True allok &= check("Uhrzeit", "Es ist 18:01 Uhr.", must_have=["achtzehn Uhr", "eins"], must_not=[":", "18:"]) allok &= check("Uhrzeit :00", "Um 18:00.", must_have=["achtzehn Uhr"], must_not=[":"]) allok &= check("Uhrzeit HH:MM", "Treffen um 9:30 Uhr.", must_have=["neun Uhr", "dreißig"], must_not=[":"]) allok &= check("Einheit GB verbalisiert", "Sie hat 16 GB Speicher.", must_have=["sechzehn GB"], must_not=[" 16 "]) allok &= check("Einheit TB + GB", "8 TB und 32 GB RAM.", must_have=["acht TB", "zweiunddreißig GB", "RAM"]) allok &= check("Dezimal verbalisiert", "Läuft mit 4.5 GHz.", must_have=["vier Komma", "fünf", "GHz"], must_not=["4.5"]) allok &= check("Modellnummer geschützt", "Die RX 9070 XT ist schnell.", must_have=["9070", "XT"], must_not=["neuntausend"]) allok &= check("Version geschützt", "Qwen3.6 nutzt Version 2.", must_have=["Qwen3.6", "zwei"], must_not=["Qwen3.sechs"]) allok &= check("Modell H100 geschützt", "Das braucht eine H100.", must_have=["H100"]) allok &= check("Zahl im Text", "Ich habe 5 Äpfel.", must_have=["fünf", "Äpfel"], must_not=[" 5 "]) allok &= check("Prozent", "Das sind 50 Prozent.", must_have=["fünfzig Prozent"]) allok &= check("Grad", "Es sind 25 Grad.", must_have=["fünfundzwanzig Grad"]) allok &= check("Jahr", "Im Jahr 2026.", must_have=["zweitausend"], must_not=["2026"]) allok &= check("Datum-Ordinal", "Am 3. Januar.", must_have=["Januar"], must_not=["3. Januar", " 3 "]) allok &= check("große ID roh", "Fehler 123456.", must_have=["123456"]) print("\nALLE TESTS GRÜN" if allok else "\nES GAB FEHLER") raise SystemExit(0 if allok else 1)