From ec4fe27a41af8ce82cce7d5f0d04ae1e4c8cb7dc Mon Sep 17 00:00:00 2001 From: Benjamin Herron Date: Wed, 31 Jul 2024 11:33:09 +0800 Subject: [PATCH 1/2] added updated regex for AU passports and updated tests --- pyvalidator/is_passport_number.py | 2 +- test/test_is_passport_number.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pyvalidator/is_passport_number.py b/pyvalidator/is_passport_number.py index 08f5947..48d46b8 100644 --- a/pyvalidator/is_passport_number.py +++ b/pyvalidator/is_passport_number.py @@ -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 diff --git a/test/test_is_passport_number.py b/test/test_is_passport_number.py index 8fe3022..cc977b9 100644 --- a/test/test_is_passport_number.py +++ b/test/test_is_passport_number.py @@ -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"], @@ -105,6 +106,7 @@ def test_invalid_passport_number(self): ['A11811035', "AR"], ['0 1630837', "AT"], ['1A012345', "AU"], + ['1AP012345', "AU"], ['ABC123456', "BA"], ['ABC123456', "BG"], ['ABX29332', "BR"], From 004a944ad76b533038347780cf3ae8a48708d551 Mon Sep 17 00:00:00 2001 From: Benjamin Herron Date: Wed, 31 Jul 2024 15:02:36 +0800 Subject: [PATCH 2/2] added sg passport regex and tests --- pyvalidator/is_passport_number.py | 1 + test/test_is_passport_number.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/pyvalidator/is_passport_number.py b/pyvalidator/is_passport_number.py index 48d46b8..1d082fe 100644 --- a/pyvalidator/is_passport_number.py +++ b/pyvalidator/is_passport_number.py @@ -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 diff --git a/test/test_is_passport_number.py b/test/test_is_passport_number.py index cc977b9..a58d680 100644 --- a/test/test_is_passport_number.py +++ b/test/test_is_passport_number.py @@ -86,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"], @@ -164,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"],