Skip to content

test: add regression tests for passport number normalization (#253) - #299

Open
faizkhairi wants to merge 1 commit into
malaysia-ai:masterfrom
faizkhairi:test/passport-normalization
Open

test: add regression tests for passport number normalization (#253)#299
faizkhairi wants to merge 1 commit into
malaysia-ai:masterfrom
faizkhairi:test/passport-normalization

Conversation

@faizkhairi

Copy link
Copy Markdown

Summary

Adds test coverage for passport number normalization (issue #253). The fix was implemented in commit 0c98809 but had no test cases to prevent future regressions.

What's tested

Verifies that passport numbers like EL9568719 and A20964577 are expanded digit-by-digit (e.g., "E L nine five six eight...") rather than as cardinal numbers (e.g., "nine million five hundred...").

The test asserts that normalized output does not contain cardinal expansion words ("million", "thousand", "hundred", "juta", "ribu", "ratus").

Why this matters

The normalizer pipeline has ~30 pattern checks in sequence. A regression in pattern ordering or regex changes could cause passport numbers to fall through to the cardinal number handler (line 1209 in rules.py). This test catches that.

Files changed

File Change
tests/tests/test_normalization.py Add test_passport_normalization() + import malaya.normalizer.rules

Test plan

  • pytest tests/tests/test_normalization.py::test_passport_normalization -v

Add test_passport_normalization() to verify that passport numbers
(e.g., EL9568719, A20964577) are expanded digit-by-digit, not as
cardinal numbers (e.g., "nine million five hundred...").

Regression test for malaysia-ai#253. The fix was implemented in commit 0c98809
but had no test coverage to prevent future regressions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant