diff options
| author | Bobby <[email protected]> | 2022-11-27 15:36:40 -0500 |
|---|---|---|
| committer | Bobby <[email protected]> | 2022-11-27 15:36:40 -0500 |
| commit | 473c86e0ac00cc479401c40d05ad6cbc10d2cf0d (patch) | |
| tree | cd591dc2a11b005ab17071e3678991cb2800e910 /tests | |
| parent | 2076d462ed8c38a1202fd5ca5b20f0e07accbbee (diff) | |
| download | edify-473c86e0ac00cc479401c40d05ad6cbc10d2cf0d.tar.xz edify-473c86e0ac00cc479401c40d05ad6cbc10d2cf0d.zip | |
added zip code validator
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_zip.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/test_zip.py b/tests/test_zip.py new file mode 100644 index 0000000..18632f7 --- /dev/null +++ b/tests/test_zip.py @@ -0,0 +1,42 @@ +from edify.library import zip + +def test_valid_zips(): + 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") + 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 + } + for zip_string, expectation in zips.items(): + assert zip(zip_string, locale="IN") == expectation + + |
