Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdnum/cn/ric.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_birth_place(number: str) -> dict[str, str]:
number = compact(number)
results = numdb.get('cn/loc').info(number[:6])
info = {k: v for part, props in results for k, v in props.items()}
if not info:
if 'county' not in info:
raise InvalidComponent()
year = get_birth_date(number).year
# check if any found county was assigned at the birth year
Expand Down
6 changes: 6 additions & 0 deletions tests/test_cn_ric.doctest
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,9 @@ Invalid location:
Traceback (most recent call last):
...
InvalidComponent: ...
>>> ric.validate('361426199101010072') # known province, unknown county code
Traceback (most recent call last):
...
InvalidComponent: ...
>>> ric.is_valid('361426199101010072')
False
Loading