Skip to content

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Pandede committed Sep 18, 2024
1 parent 007c783 commit d874fba
Showing 1 changed file with 83 additions and 2 deletions.
85 changes: 83 additions & 2 deletions tests/providers/test_internet.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,11 @@ def test_internet(self, faker):
tld = faker.tld()
assert isinstance(tld, str)

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestZhCn:
"""Test zh_CN internet provider methods"""
Expand Down Expand Up @@ -647,6 +652,11 @@ def test_domain_name_bad_level(self, faker):
with pytest.raises(ValueError):
faker.domain_name(levels=0)

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestZhTw:
"""Test zh_TW internet provider methods"""
Expand All @@ -655,6 +665,11 @@ def test_email(self, faker):
email = faker.email()
validate_email(email)

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestHuHu:
"""Test hu_HU internet provider methods"""
Expand All @@ -667,6 +682,11 @@ def test_internet(self, faker):
email = faker.email()
assert isinstance(email, str)

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestPlPl:
"""Test pl_PL internet provider methods"""
Expand All @@ -679,6 +699,11 @@ def test_tld(self, faker):
tld = faker.tld()
assert tld in PlPlInternetProvider.tlds

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestNlNl:
"""Test nl_NL internet provider methods"""
Expand Down Expand Up @@ -710,6 +735,11 @@ def test_ascii_company_email(self, faker):
validate_email(email)
assert email.split("@")[0] == "fabienne"

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestArAa:
"""Test ar_AA internet provider methods"""
Expand Down Expand Up @@ -741,6 +771,11 @@ def test_ascii_company_email(self, faker):
validate_email(email)
assert email.split("@")[0] == "asyl"

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestAzAz:
"""Test az_AZ internet provider methods"""
Expand All @@ -762,6 +797,11 @@ def test_tld(self, faker):
tld = faker.tld()
assert tld in AzAzInternetProvider.tlds

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestPtBr:
"""Test pt_BR internet provider methods"""
Expand Down Expand Up @@ -793,6 +833,11 @@ def test_ascii_company_email(self, faker):
validate_email(email)
assert email.split("@")[0] == "andrecaua"

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestEnPh:
"""Test en_PH internet provider methods"""
Expand All @@ -804,17 +849,28 @@ def test_domain_name(self, faker, num_samples):
domain = faker.domain_name()
validate_domain(domain)

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestFilPh(TestEnPh):
"""Test fil_PH internet provider methods"""

pass
def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestTlPh(TestFilPh):
"""Test tl_PH internet provider methods"""

pass
def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestEnGb:
Expand All @@ -828,6 +884,11 @@ def test_tld(self, faker):
tld = faker.tld()
assert tld in EnGbInternetProvider.tlds

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestEsEs:
"""Tests for the es_ES locale."""
Expand All @@ -836,6 +897,11 @@ def test_tld(self, faker):
tld = faker.tld()
assert tld in EsEsInternetProvider.tlds

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestRoRo:
"""Test ro_RO internet provider methods"""
Expand All @@ -848,6 +914,11 @@ def test_tld(self, faker):
tld = faker.tld()
assert tld in PlPlInternetProvider.tlds

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestRuRu:
"""Test ru_RU internet provider methods"""
Expand Down Expand Up @@ -885,10 +956,20 @@ def test_ascii_company_email(self, faker):
validate_email(email)
assert email.split("@")[0] == "sergekuznetsov"

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""


class TestThTh:
"""Test th_TH internet provider methods"""

def test_tld(self, faker):
tld = faker.tld()
assert tld in ThThInternetProvider.tlds

def test_slug(self, faker):
num_of_samples = 100
for _ in range(num_of_samples):
assert faker.slug() != ""

0 comments on commit d874fba

Please sign in to comment.