Skip to content

Commit 15dcb04

Browse files
authored
Fix: Updated AU regex and added SG regex for is_passport. (#23)
* added updated regex for AU passports and updated tests * added sg passport regex and tests
1 parent ffb23f7 commit 15dcb04

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pyvalidator/is_passport_number.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"AM": r"^[A-Z]{2}\d{7}$", # ARMENIA
66
"AR": r"^[A-Z]{3}\d{6}$", # ARGENTINA
77
"AT": r"^[A-Z]\d{7}$", # AUSTRIA
8-
"AU": r"^[A-Z]\d{7}$", # AUSTRALIA
8+
"AU": r"^([A-Z]{2}\d{7}|[A-Z]{1}\d{7})$", # AUSTRALIA
99
"BA": r"^[A-Z]\d{7}$", # BOSNIA AND HERZEGOVINA,
1010
"BE": r"^[A-Z]{2}\d{6}$", # BELGIUM
1111
"BG": r"^\d{9}$", # BULGARIA
@@ -49,6 +49,7 @@
4949
"RS": r"^\d{9}$", # SERBIA,
5050
"RU": r"^\d{9}$", # RUSSIAN FEDERATION
5151
"SE": r"^\d{8}$", # SWEDEN
52+
"SG": r"^(e|E)\d{7}[a-zA-Z]{1}$", # SINGAPORE
5253
"SL": r"^(P)[A-Z]\d{7}$", # SLOVENIA
5354
"SK": r"^[0-9A-Z]\d{7}$", # SLOVAKIA
5455
"TR": r"^[A-Z]\d{8}$", # TURKEY

test/test_is_passport_number.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def test_valid_passport_number(self):
1616
['P 1630837', "AT"],
1717
['P 4366918', "AT"],
1818
['N0995852', "AU"],
19+
['PN0995852', "AU"],
1920
['L4819236', "AU"],
2021
['A1234567', "BA"],
2122
['346395366', "BG"],
@@ -85,6 +86,8 @@ def test_valid_passport_number(self):
8586
['2 32 636829', "RU"],
8687
['012 345321', "RU"],
8788
['59000001', "SE"],
89+
['E1234567S', "SG"],
90+
['e9999991Q', "SG"],
8891
['PB0036440', "SL"],
8992
['P0000000', "SK"],
9093
['U 06764100', "TR"],
@@ -105,6 +108,7 @@ def test_invalid_passport_number(self):
105108
['A11811035', "AR"],
106109
['0 1630837', "AT"],
107110
['1A012345', "AU"],
111+
['1AP012345', "AU"],
108112
['ABC123456', "BA"],
109113
['ABC123456', "BG"],
110114
['ABX29332', "BR"],
@@ -162,6 +166,8 @@ def test_invalid_passport_number(self):
162166
['01A 3D5321', "RU"],
163167
['A 2R YU46J0', "RU"],
164168
['SE012345', "SE"],
169+
['S1234567E', "SG"],
170+
['E99999911', "SG"],
165171
['SL0123456', "SL"],
166172
['SK012345', "SK"],
167173
['06764100U', "TR"],

0 commit comments

Comments
 (0)