- Cloze card pipeline: 924 cards from 2,296 AI-vetted Hebrew book sentences - Plurals deck: 375 notes (144 irregular + 231 regular from 86 mishkal patterns) - Ktiv male forms expanded to 20,711 entries for sentence matching - Project reorg: helpers.py (deduped strip_nikkud from 10 files), scripts/ for one-off tools, tests/ with smoke tests, deleted 3 dead files - Lint tooling: pyproject.toml with ruff/vulture/bandit/pytest config, .editorconfig, fixed all 129 ruff errors (B023 closure fix, SIM103, unused vars) - validate_apkg.py: card count range check for optional cloze template - Data caches committed: vetted_sentences, ktiv_male_forms, noun_plurals, noun_slug_map, vocab_sentence_matches, epub_sentence_index Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
45 lines
1.3 KiB
Python
45 lines
1.3 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 / "hebrew_dict_for_anki.csv").exists(), "vocab CSV missing"
|
|
assert (data_dir / "conjugations.json").exists(), "conjugations cache 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}"
|