Skip to content
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

Repair unit test for phone number sk_SK #2020

Merged
merged 3 commits into from
Apr 5, 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
13 changes: 9 additions & 4 deletions faker/providers/phone_number/sk_SK/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,25 @@

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
6 changes: 5 additions & 1 deletion tests/providers/test_phone_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@
"""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}$)")

Check failure on line 83 in tests/providers/test_phone_number.py

View workflow job for this annotation

GitHub Actions / test_ubuntu (3.11)

AssertionError

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