Skip to content

Commit

Permalink
Merge branch 'george0st-repair_sk_phone'
Browse files Browse the repository at this point in the history
  • Loading branch information
fcurella committed Apr 5, 2024
2 parents dcf00b7 + db81efd commit 591cffe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 7 additions & 4 deletions faker/providers/phone_number/sk_SK/__init__.py
Expand Up @@ -3,20 +3,23 @@

class Provider(PhoneNumberProvider):
formats = (
# pattern I.
"00421 2 ########",
"+421 2 ########",
# patter II.
"00421 3# ### ####",
"00421 4# ### ####",
"00421 5# ### ####",
"+421 3# ### ####",
"+421 4# ### ####",
"+421 5# ### ####",
# pattern III.
"00421 90# ### ###",
"00421 91# ### ###",
"00421 940 ### ###",
"00421 944 ### ###",
"00421 948 ### ###",
"00421 949 ### ###",
"+421 2 ########",
"+421 3# ### ####",
"+421 4# ### ####",
"+421 5# ### ####",
"+421 90# ### ###",
"+421 91# ### ###",
"+421 940 ### ###",
Expand Down
7 changes: 6 additions & 1 deletion tests/providers/test_phone_number.py
Expand Up @@ -77,7 +77,12 @@ class TestSkSk:
"""Test sk_SK phone number provider methods"""

def test_phone_number(self, faker, num_samples):
pattern: Pattern = re.compile(r"^(00421|\+421)? ?[2-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$")
pattern: Pattern = re.compile(
r"(^(00421|\+421)? ?[2] ?[0-9]{8}$)|"
r"(^(00421|\+421)? ?[3-5][0-9] ?[0-9]{3} ?[0-9]{4}$)|"
r"(^(00421|\+421)? ?[9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$)"
)

for _ in range(num_samples):
phone_number = faker.phone_number()
assert pattern.fullmatch(phone_number)
Expand Down

0 comments on commit 591cffe

Please sign in to comment.