Template & CSS fixes (15 items from Mar 9 feedback): - Fix conjugation front showing 3ms form instead of infinitive - Rename conjugation model to "Hebrew Conjugation" - Strip Hebrew parenthesized text from English meanings - Shoresh separator: spaces → dots (א.כ.ל) - Remove duplicate English meaning from cloze back - Remove example sentences from vocab front/back (cloze only) - Center-align audio buttons on all decks - Fix parenthesis spacing: "you(feminine,singular)" → "you (feminine, singular)" - Unify sec-key/sec-label fonts, make keys bold - Size overhaul: bigger Hebrew (42px), meaning (34px), secondary (28px) - Center-align related words groups - Sort confusables by average frequency - Plurals: show Gender (Hebrew) before Mishkal, strip emoji from meaning - Clean duplicate quotation marks in cloze sentences Sprint 12 carry-forward (detail scrape + EPUB): - Adjective/preposition detail scraping in pealim_detail_scrape.py - EPUB example matching rewrite in epub_examples.py - Delete benyehuda.py and rebuild_sentence_matches.py (merged) - 49 parser tests for detail scraping - SCHEMA.yaml updates for new fields Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
58 lines
1.8 KiB
Python
58 lines
1.8 KiB
Python
"""Smoke tests for the Hebrew Flash Cards project."""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Ensure project root is on path
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
|
|
|
|
|
def test_helpers_strip_nikkud():
|
|
from helpers import strip_nikkud
|
|
|
|
assert strip_nikkud("שָׁלוֹם") == "שלום"
|
|
assert strip_nikkud("hello") == "hello"
|
|
assert strip_nikkud("") == ""
|
|
|
|
|
|
def test_apkg_builder_imports():
|
|
import apkg_builder
|
|
|
|
assert hasattr(apkg_builder, "build_vocab_deck")
|
|
assert hasattr(apkg_builder, "build_conj_deck")
|
|
assert apkg_builder.VOCAB_MODEL_ID == 1_701_222_017_968
|
|
|
|
|
|
def test_data_files_exist():
|
|
data_dir = Path(__file__).resolve().parent.parent / "data"
|
|
assert (data_dir / "words.json").exists(), "words.json missing"
|
|
|
|
|
|
def test_strip_nikkud_idempotent():
|
|
from helpers import strip_nikkud
|
|
|
|
plain = "שלום"
|
|
assert strip_nikkud(plain) == plain
|
|
|
|
|
|
def test_strip_nikkud_all_marks():
|
|
from helpers import strip_nikkud
|
|
|
|
# Comprehensive: patach, kamatz, segol, tsere, hiriq, holam, kubutz, shva, dagesh
|
|
nikkud = "הַמַּלְכָּה"
|
|
plain = strip_nikkud(nikkud)
|
|
assert all(ch < "\u0591" or ch > "\u05c7" for ch in plain), f"Residual nikkud in: {plain}"
|
|
|
|
|
|
def test_categorize_pos_no_substring_match():
|
|
"""Regression: 'Pronoun' must NOT match 'Noun' category."""
|
|
from apkg_builder import _categorize_pos
|
|
|
|
assert _categorize_pos("Noun") == "Noun"
|
|
assert _categorize_pos("Verb") == "Verb"
|
|
assert _categorize_pos("Adjective") == "Adjective"
|
|
assert _categorize_pos("Adverb") == "Adverb"
|
|
assert _categorize_pos("Pronoun") == "Other", "Pronoun must not match Noun"
|
|
assert _categorize_pos("Preposition") == "Other"
|
|
assert _categorize_pos("Conjunction") == "Other"
|
|
assert _categorize_pos("Cardinal numeral") == "Other"
|