partition: 39
languages: es
names: !include country-names/ar.yaml
+ postcode:
+ pattern: "l?dddd(?:lll)?"
# (American Samoa)
partition: 62
languages: ar
names: !include country-names/bh.yaml
+ postcode:
+ pattern: "d?ddd"
# Burundi (Burundi)
partition: 114
languages: el, tr
names: !include country-names/cy.yaml
+ postcode:
+ pattern: "(?:99|d)ddd"
# Czechia (Česko)
partition: 91
languages: en
names: !include country-names/fk.yaml
+ postcode:
+ pattern: "FIQQ 1ZZ"
# Federated States of Micronesia (Micronesia)
partition: 211
languages: en
names: !include country-names/gh.yaml
+ postcode:
+ pattern: "ll-d?ddd-dddd"
# Gibraltar (Gibraltar)
partition: 94
languages: kk, ru
names: !include country-names/kz.yaml
+ postcode:
+ pattern: "(?:lddldld|dddddd)"
# Laos (ປະເທດລາວ)
partition: 242
languages: fr
names: !include country-names/mc.yaml
+ postcode:
+ pattern: "980dd"
# Moldova (Moldova)
partition: 195
languages: en, pau, ja, sov, tox
names: !include country-names/pw.yaml
+ postcode:
+ pattern: "969(39|40)"
# Paraguay (Paraguay)
partition: 153
languages: it
names: !include country-names/sm.yaml
+ postcode:
+ pattern: "4789d"
# Senegal (Sénégal)
partition: 82
languages: en, ss
names: !include country-names/sz.yaml
+ postcode:
+ pattern: "lddd"
# Turks and Caicos Islands (Turks and Caicos Islands)
partition: 198
languages: en
names: !include country-names/um.yaml
+ postcode:
+ pattern: "96898"
# United States (United States)
partition: 107
languages: it
names: !include country-names/va.yaml
+ postcode:
+ pattern: "00120"
# Saint Vincent and the Grenadines (Saint Vincent and the Grenadines)
@pytest.mark.sanitizer_params(convert_to_address=False)
def test_postcode_drop_bad_format(sanitize, postcode):
assert sanitize(country='de', postcode=postcode) == []
+
+
+@pytest.mark.parametrize("postcode", ('1234', '9435', '99000'))
+def test_postcode_cyprus_pass(sanitize, postcode):
+ assert sanitize(country='cy', postcode=postcode) == [('postcode', postcode)]
+
+
+@pytest.mark.parametrize("postcode", ('91234', '99a45', '567'))
+@pytest.mark.sanitizer_params(convert_to_address=False)
+def test_postcode_cyprus_fail(sanitize, postcode):
+ assert sanitize(country='cy', postcode=postcode) == []
+
+
+@pytest.mark.parametrize("postcode", ('123456', 'A33F2G7'))
+def test_postcode_kazakhstan_pass(sanitize, postcode):
+ assert sanitize(country='kz', postcode=postcode) == [('postcode', postcode)]
+
+
+@pytest.mark.parametrize("postcode", ('V34T6Y923456', '99345'))
+@pytest.mark.sanitizer_params(convert_to_address=False)
+def test_postcode_kazakhstan_fail(sanitize, postcode):
+ assert sanitize(country='kz', postcode=postcode) == []
+