refactor(anaf): remove dead code in sanitize_cui, fix empty test
Remove unreachable OCR-skip fallback (raw_bare can't be all-digits if strip_ro_prefix changed it via OCR fix). Add real test for the checksum result==10→0 branch using CUI 14186770. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -148,15 +148,14 @@ class TestValidateCuiChecksum:
|
||||
assert validate_cui_checksum("1") is False
|
||||
|
||||
def test_checksum_result_10_becomes_0(self):
|
||||
"""When (sum*10)%11 == 10, check digit should be 0."""
|
||||
# Build a CUI where the algorithm yields 10
|
||||
# Body 12345678 → pad to 9: 012345678
|
||||
# 0*7+1*5+2*3+3*2+4*1+5*7+6*5+7*3+8*2 = 0+5+6+6+4+35+30+21+16 = 123
|
||||
# 123*10=1230, 1230%11 = 111*11=1221, remainder=9 → check=9 → not 10
|
||||
# Let's just verify a known CUI ending in 0 works
|
||||
# CUI 46628322 from data: check=2, not 0. Skip this specific edge case test
|
||||
# and just verify the code path exists
|
||||
pass
|
||||
"""When (sum*10)%11 == 10, check digit should be 0.
|
||||
|
||||
CUI 14186770: body=1418677, padded=001418677,
|
||||
sum=0+0+3+8+1+42+35+21+14=124, 1240%11=10 → check=0.
|
||||
"""
|
||||
assert validate_cui_checksum("14186770") is True
|
||||
# Wrong check digit for same body
|
||||
assert validate_cui_checksum("14186771") is False
|
||||
|
||||
|
||||
# ===========================================================================
|
||||
|
||||
Reference in New Issue
Block a user