Skip to content

Fix: Updated AU regex and added SG regex for is_passport. #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 31, 2024
Merged
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
3 changes: 2 additions & 1 deletion pyvalidator/is_passport_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"AM": r"^[A-Z]{2}\d{7}$", # ARMENIA
"AR": r"^[A-Z]{3}\d{6}$", # ARGENTINA
"AT": r"^[A-Z]\d{7}$", # AUSTRIA
"AU": r"^[A-Z]\d{7}$", # AUSTRALIA
"AU": r"^([A-Z]{2}\d{7}|[A-Z]{1}\d{7})$", # AUSTRALIA
"BA": r"^[A-Z]\d{7}$", # BOSNIA AND HERZEGOVINA,
"BE": r"^[A-Z]{2}\d{6}$", # BELGIUM
"BG": r"^\d{9}$", # BULGARIA
Expand Down Expand Up @@ -49,6 +49,7 @@
"RS": r"^\d{9}$", # SERBIA,
"RU": r"^\d{9}$", # RUSSIAN FEDERATION
"SE": r"^\d{8}$", # SWEDEN
"SG": r"^(e|E)\d{7}[a-zA-Z]{1}$", # SINGAPORE
"SL": r"^(P)[A-Z]\d{7}$", # SLOVENIA
"SK": r"^[0-9A-Z]\d{7}$", # SLOVAKIA
"TR": r"^[A-Z]\d{8}$", # TURKEY
Expand Down
6 changes: 6 additions & 0 deletions test/test_is_passport_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def test_valid_passport_number(self):
['P 1630837', "AT"],
['P 4366918', "AT"],
['N0995852', "AU"],
['PN0995852', "AU"],
['L4819236', "AU"],
['A1234567', "BA"],
['346395366', "BG"],
Expand Down Expand Up @@ -85,6 +86,8 @@ def test_valid_passport_number(self):
['2 32 636829', "RU"],
['012 345321', "RU"],
['59000001', "SE"],
['E1234567S', "SG"],
['e9999991Q', "SG"],
['PB0036440', "SL"],
['P0000000', "SK"],
['U 06764100', "TR"],
Expand All @@ -105,6 +108,7 @@ def test_invalid_passport_number(self):
['A11811035', "AR"],
['0 1630837', "AT"],
['1A012345', "AU"],
['1AP012345', "AU"],
['ABC123456', "BA"],
['ABC123456', "BG"],
['ABX29332', "BR"],
Expand Down Expand Up @@ -162,6 +166,8 @@ def test_invalid_passport_number(self):
['01A 3D5321', "RU"],
['A 2R YU46J0', "RU"],
['SE012345', "SE"],
['S1234567E', "SG"],
['E99999911', "SG"],
['SL0123456', "SL"],
['SK012345', "SK"],
['06764100U', "TR"],
Expand Down
Loading