diff options
| author | Bobby <[email protected]> | 2022-11-27 16:20:38 -0500 |
|---|---|---|
| committer | Bobby <[email protected]> | 2022-11-27 16:20:38 -0500 |
| commit | b9b6b54eac925b75f3ed844f65832e5bd09e251e (patch) | |
| tree | b18111660ecda6741da8654e96380bce852aeaec /tests | |
| parent | b245307f903d8eee53e880c3d68b77ee32d07003 (diff) | |
| download | edify-b9b6b54eac925b75f3ed844f65832e5bd09e251e.tar.xz edify-b9b6b54eac925b75f3ed844f65832e5bd09e251e.zip | |
fixing lint
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ssn_test.py | 1 | ||||
| -rw-r--r-- | tests/test_guid.py | 6 | ||||
| -rw-r--r-- | tests/test_mac.py | 1 | ||||
| -rw-r--r-- | tests/test_password.py | 13 | ||||
| -rw-r--r-- | tests/test_url.py | 6 | ||||
| -rw-r--r-- | tests/test_uuid.py | 1 | ||||
| -rw-r--r-- | tests/test_zip.py | 24 |
7 files changed, 27 insertions, 25 deletions
diff --git a/tests/ssn_test.py b/tests/ssn_test.py index 8317ec0..ce2a57b 100644 --- a/tests/ssn_test.py +++ b/tests/ssn_test.py @@ -1,5 +1,6 @@ from edify.library import ssn + def test_ssn(): ssns = { "000-22-3333": False, diff --git a/tests/test_guid.py b/tests/test_guid.py index bc0cb1a..b4b1a64 100644 --- a/tests/test_guid.py +++ b/tests/test_guid.py @@ -1,11 +1,11 @@ from edify.library import guid + def test_valid_guids(): guids = { "6ba7b810-9dad-11d1-80b4-00c04fd430c8": True, - '{51d52cf1-83c9-4f02-b117-703ecb728b74}' : True, - '{51d52cf1-83c9-4f02-b117-703ecb728-b74}' : False + '{51d52cf1-83c9-4f02-b117-703ecb728b74}': True, + '{51d52cf1-83c9-4f02-b117-703ecb728-b74}': False, } for guid_string, expectation in guids.items(): assert guid(guid_string) == expectation - diff --git a/tests/test_mac.py b/tests/test_mac.py index 636b649..2f24b44 100644 --- a/tests/test_mac.py +++ b/tests/test_mac.py @@ -1,5 +1,6 @@ from edify.library import mac + def test_mac(): macs = { "00:00:5e:00:53:af": True, diff --git a/tests/test_password.py b/tests/test_password.py index b4fc7fb..538874b 100644 --- a/tests/test_password.py +++ b/tests/test_password.py @@ -1,9 +1,10 @@ from edify.library import password + def test_password(): - assert password("password") == False - assert password("Password123!") == True - assert password("Password123!", max_length=8) == False - assert password("Password123!", min_upper=2) == False - assert password("password", min_upper=0, min_digit=0, min_special=0) == True - assert password("pass@#1", min_special=1, special_chars="!", min_digit=0, min_upper=0, min_length=4) == False + assert password("password") is False + assert password("Password123!") is True + assert password("Password123!", max_length=8) is False + assert password("Password123!", min_upper=2) is False + assert password("password", min_upper=0, min_digit=0, min_special=0) is True + assert password("pass@#1", min_special=1, special_chars="!", min_digit=0, min_upper=0, min_length=4) is False diff --git a/tests/test_url.py b/tests/test_url.py index d3acc78..74f8ed1 100644 --- a/tests/test_url.py +++ b/tests/test_url.py @@ -13,12 +13,14 @@ urls = [ "//example.com", ] + def test_all_protocols(): match_list = ["proto", "no_proto"] expected = [True] * 9 + [False] for uri, expectation in zip(urls, expected): assert url(uri, match=match_list) == expectation + def test_proto_only(): match_list = ["proto"] expected = [False] * 3 + [True] * 6 + [False] @@ -26,12 +28,14 @@ def test_proto_only(): print(uri, expectation) assert url(uri, match=match_list) == expectation + def test_no_proto_only(): match_list = ["no_proto"] expected = [True] * 3 + [False] * 7 for uri, expectation in zip(urls, expected): assert url(uri, match=match_list) == expectation + def test_invalid_protocol(): match_list = ["invalid"] for uri in urls: @@ -40,6 +44,7 @@ def test_invalid_protocol(): except ValueError: assert True + def test_invalid_match_type(): match_list = "invalid" for uri in urls: @@ -48,6 +53,7 @@ def test_invalid_match_type(): except TypeError: assert True + def test_empty_match_list(): match_list = [] for uri in urls: diff --git a/tests/test_uuid.py b/tests/test_uuid.py index 6c37b17..df4e840 100644 --- a/tests/test_uuid.py +++ b/tests/test_uuid.py @@ -7,6 +7,7 @@ uuids = { "123e456": False, } + def test_valid_uuids(): for uuid_string, expectation in uuids.items(): assert uuid(uuid_string) == expectation diff --git a/tests/test_zip.py b/tests/test_zip.py index 18632f7..999d55d 100644 --- a/tests/test_zip.py +++ b/tests/test_zip.py @@ -1,42 +1,34 @@ from edify.library import zip + def test_valid_zips(): - zips = { - "12345": True, - "12345-1234": True, - "12345-123456": False, - "1234": False - } + zips = {"12345": True, "12345-1234": True, "12345-123456": False, "1234": False} for zip_string, expectation in zips.items(): assert zip(zip_string) == expectation + def test_invalid_locale(): try: - zip("12345", locale = "INVALID") + zip("12345", locale="INVALID") except ValueError: assert True + def test_invalid_locale_type(): try: zip("12345", 5) except TypeError: assert True + def test_empty_locale(): try: zip("12345", "") except ValueError: assert True + def test_locale_IN(): - zips = { - "123456": True, - "000000": False, - "012345": False, - "12345": False, - "1234567": False - } + zips = {"123456": True, "000000": False, "012345": False, "12345": False, "1234567": False} for zip_string, expectation in zips.items(): assert zip(zip_string, locale="IN") == expectation - - |
