Testing
Testing keeps Python and TypeScript behavior aligned and catches asset regressions before release.
Runtime suites
cd hama/python
uv sync --extra test
uv run pytest
uv run pytest tests/test_asr.py -q
uv run pytest tests/test_split_assets.py -q cd hama/ts
bun install
bun run build
bun test
bun test tests/asr.test.ts
bun run validate:model:split
bun run validate:asr
bun run validate:browser
bun run validate:browser:asr The Python suite covers tokenizer invariants, split-asset loading, and ASR behavior. The TypeScript suite checks Node + browser bindings, CTC decoding, split-model loading, WAV inference, and browser-specific validators for both G2P and ASR. Some Bun versions may panic after printing successful test output; read the test results first, then treat the panic as a separate runtime issue.
Cross-runtime parity
Before releasing, compare representative G2P and ASR outputs across Python and TypeScript using the same assets. Treat mismatches in IPA strings, alignment indices, or decoded ASR tokens as release blockers.
Smoke tests
- Execute
uv run python -c “from hama import G2PModel; print(G2PModel().predict(‘안녕하세요’).ipa)”anduv run python python/example.py. - Run
uv run python ../examples/python_asr.py; omit—wavfor the synthetic smoke input. - Run
node ts/example.jsafter buildingts/. - Run
bun run validate:model:split,bun run validate:asr,bun run validate:browser, andbun run validate:browser:asrbefore publishing. - Open the Astro site locally and check both the browser G2P demo and
/research/umsfor browser regressions.
CI recommendations
- Run tests for both runtimes on every PR.
- Gate releases on split-model, ASR, and browser validator success.
- Publish preview packages for QA when ONNX assets or vocabularies change.