diff --git a/package/requirements.testing.txt b/package/requirements.testing.txt index c763dc12..078d6822 100644 --- a/package/requirements.testing.txt +++ b/package/requirements.testing.txt @@ -41,9 +41,9 @@ pycryptodome==3.20.0 \ --hash=sha256:f35d6cee81fa145333137009d9c8ba90951d7d77b67c79cbe5f03c7eb74d8fe2 \ --hash=sha256:f47888542a0633baff535a04726948e876bf1ed880fddb7c10a736fa99146ab3 \ --hash=sha256:fb3b87461fa35afa19c971b0a2b7456a7b1db7b4eba9a8424666104925b78128 -pytest==8.2.2 \ - --hash=sha256:c434598117762e2bd304e526244f67bf66bbd7b5d6cf22138be51ff661980343 \ - --hash=sha256:de4bb8104e201939ccdc688b27a89a7be2079b22e2bd2b07f806b6ba71117977 +pytest==8.3.2 \ + --hash=sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5 \ + --hash=sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce tomli==2.0.1; python_version < "3.11" \ --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f diff --git a/pyproject.toml b/pyproject.toml index fba675fc..b40020bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -126,7 +126,11 @@ pythonPlatform = "All" typeCheckingMode = "strict" [tool.pytest.ini_options] +minversion = "6.0" pythonpath = ["src"] +testpaths = "tests" +addopts = ["--doctest-modules"] + [tool.ruff] lint.select = [ diff --git a/src/validators/_extremes.py b/src/validators/_extremes.py index a7ff806d..fda93f98 100644 --- a/src/validators/_extremes.py +++ b/src/validators/_extremes.py @@ -12,13 +12,13 @@ class AbsMax: Inspired by https://pypi.python.org/pypi/Extremes. Examples: - >>> from sys import maxint - >>> AbsMax > AbsMin - # Output: True - >>> AbsMax > maxint - # Output: True - >>> AbsMax > 99999999999999999 - # Output: True + >>> from sys import maxsize + >>> AbsMax() > AbsMin() + True + >>> AbsMax() > maxsize + True + >>> AbsMax() > 99999999999999999 + True """ def __ge__(self, other: Any): @@ -33,13 +33,13 @@ class AbsMin: Inspired by https://pypi.python.org/pypi/Extremes. Examples: - >>> from sys import maxint - >>> AbsMin < -maxint - # Output: True - >>> AbsMin < None - # Output: True - >>> AbsMin < '' - # Output: True + >>> from sys import maxsize + >>> AbsMin() < -maxsize + True + >>> AbsMin() < None + True + >>> AbsMin() < '' + True """ def __le__(self, other: Any): diff --git a/src/validators/between.py b/src/validators/between.py index 6a65d5c9..14ef4e04 100644 --- a/src/validators/between.py +++ b/src/validators/between.py @@ -29,16 +29,16 @@ def between( Examples: >>> from datetime import datetime >>> between(5, min_val=2) - # Output: True + True >>> between(13.2, min_val=13, max_val=14) - # Output: True + True >>> between(500, max_val=400) - # Output: ValidationError(func=between, args=...) + ValidationError(func=between, args={'value': 500, 'max_val': 400}) >>> between( ... datetime(2000, 11, 11), ... min_val=datetime(1999, 11, 11) ... ) - # Output: True + True Args: value: diff --git a/src/validators/card.py b/src/validators/card.py index 7801eb6b..d95643cd 100644 --- a/src/validators/card.py +++ b/src/validators/card.py @@ -17,9 +17,9 @@ def card_number(value: str, /): Examples: >>> card_number('4242424242424242') - # Output: True + True >>> card_number('4242424242424241') - # Output: ValidationError(func=card_number, args={'value': '4242424242424241'}) + ValidationError(func=card_number, args={'value': '4242424242424241'}) Args: value: @@ -46,9 +46,9 @@ def visa(value: str, /): Examples: >>> visa('4242424242424242') - # Output: True + True >>> visa('2223003122003222') - # Output: ValidationError(func=visa, args={'value': '2223003122003222'}) + ValidationError(func=visa, args={'value': '2223003122003222'}) Args: value: @@ -68,9 +68,9 @@ def mastercard(value: str, /): Examples: >>> mastercard('5555555555554444') - # Output: True + True >>> mastercard('4242424242424242') - # Output: ValidationError(func=mastercard, args={'value': '4242424242424242'}) + ValidationError(func=mastercard, args={'value': '4242424242424242'}) Args: value: @@ -90,9 +90,9 @@ def amex(value: str, /): Examples: >>> amex('378282246310005') - # Output: True + True >>> amex('4242424242424242') - # Output: ValidationError(func=amex, args={'value': '4242424242424242'}) + ValidationError(func=amex, args={'value': '4242424242424242'}) Args: value: @@ -112,9 +112,9 @@ def unionpay(value: str, /): Examples: >>> unionpay('6200000000000005') - # Output: True + True >>> unionpay('4242424242424242') - # Output: ValidationError(func=unionpay, args={'value': '4242424242424242'}) + ValidationError(func=unionpay, args={'value': '4242424242424242'}) Args: value: @@ -134,9 +134,9 @@ def diners(value: str, /): Examples: >>> diners('3056930009020004') - # Output: True + True >>> diners('4242424242424242') - # Output: ValidationError(func=diners, args={'value': '4242424242424242'}) + ValidationError(func=diners, args={'value': '4242424242424242'}) Args: value: @@ -156,9 +156,9 @@ def jcb(value: str, /): Examples: >>> jcb('3566002020360505') - # Output: True + True >>> jcb('4242424242424242') - # Output: ValidationError(func=jcb, args={'value': '4242424242424242'}) + ValidationError(func=jcb, args={'value': '4242424242424242'}) Args: value: @@ -178,9 +178,9 @@ def discover(value: str, /): Examples: >>> discover('6011111111111117') - # Output: True + True >>> discover('4242424242424242') - # Output: ValidationError(func=discover, args={'value': '4242424242424242'}) + ValidationError(func=discover, args={'value': '4242424242424242'}) Args: value: diff --git a/src/validators/country.py b/src/validators/country.py index d04b0b06..6cd83ee1 100644 --- a/src/validators/country.py +++ b/src/validators/country.py @@ -245,9 +245,9 @@ def calling_code(value: str, /): Examples: >>> calling_code('+91') - # Output: True + True >>> calling_code('-31') - # Output: ValidationError(func=calling_code, args={'value': '-31'}) + ValidationError(func=calling_code, args={'value': '-31'}) Args: value: @@ -273,15 +273,15 @@ def country_code(value: str, /, *, iso_format: str = "auto", ignore_case: bool = Examples: >>> country_code('GB', iso_format='alpha3') - # Output: False + ValidationError(func=country_code, args={'value': 'GB', 'iso_format': 'alpha3'}) >>> country_code('USA') - # Output: True + True >>> country_code('840', iso_format='numeric') - # Output: True + True >>> country_code('iN', iso_format='alpha2') - # Output: False + ValidationError(func=country_code, args={'value': 'iN', 'iso_format': 'alpha2'}) >>> country_code('ZWE', iso_format='alpha3') - # Output: True + True Args: value: @@ -327,9 +327,9 @@ def currency(value: str, /, *, skip_symbols: bool = True, ignore_case: bool = Fa Examples: >>> currency('USD') - # Output: True + True >>> currency('ZWX') - # Output: ValidationError(func=currency, args={'value': 'ZWX'}) + ValidationError(func=currency, args={'value': 'ZWX'}) Args: value: diff --git a/src/validators/cron.py b/src/validators/cron.py index 58976510..a8449b6a 100644 --- a/src/validators/cron.py +++ b/src/validators/cron.py @@ -44,9 +44,9 @@ def cron(value: str, /): Examples: >>> cron('*/5 * * * *') - # Output: True + True >>> cron('30-20 * * * *') - # Output: ValidationError(func=cron, ...) + ValidationError(func=cron, args={'value': '30-20 * * * *'}) Args: value: diff --git a/src/validators/crypto_addresses/bsc_address.py b/src/validators/crypto_addresses/bsc_address.py index c3a24250..cabefc20 100644 --- a/src/validators/crypto_addresses/bsc_address.py +++ b/src/validators/crypto_addresses/bsc_address.py @@ -15,9 +15,9 @@ def bsc_address(value: str, /): Examples: >>> bsc_address('0x4e5acf9684652BEa56F2f01b7101a225Ee33d23f') - # Output: True + True >>> bsc_address('0x4g5acf9684652BEa56F2f01b7101a225Eh33d23z') - # Output: ValidationError(func=bsc_address, args=...) + ValidationError(func=bsc_address, args={'value': '0x4g5acf9684652BEa56F2f01b7101a225Eh33d23z'}) Args: value: @@ -26,7 +26,7 @@ def bsc_address(value: str, /): Returns: (Literal[True]): If `value` is a valid bsc address. (ValidationError): If `value` is an invalid bsc address. - """ + """ # noqa: E501 if not value: return False diff --git a/src/validators/crypto_addresses/btc_address.py b/src/validators/crypto_addresses/btc_address.py index 8c4aa453..ff401114 100644 --- a/src/validators/crypto_addresses/btc_address.py +++ b/src/validators/crypto_addresses/btc_address.py @@ -33,9 +33,9 @@ def btc_address(value: str, /): Examples: >>> btc_address('3Cwgr2g7vsi1bXDUkpEnVoRLA9w4FZfC69') - # Output: True + True >>> btc_address('1BvBMsEYstWetqTFn5Au4m4GFg7xJaNVN2') - # Output: ValidationError(func=btc_address, args=...) + ValidationError(func=btc_address, args={'value': '1BvBMsEYstWetqTFn5Au4m4GFg7xJaNVN2'}) Args: value: diff --git a/src/validators/crypto_addresses/eth_address.py b/src/validators/crypto_addresses/eth_address.py index 08bd0852..84861861 100644 --- a/src/validators/crypto_addresses/eth_address.py +++ b/src/validators/crypto_addresses/eth_address.py @@ -38,9 +38,9 @@ def eth_address(value: str, /): Examples: >>> eth_address('0x9cc14ba4f9f68ca159ea4ebf2c292a808aaeb598') - # Output: True + True >>> eth_address('0x8Ba1f109551bD432803012645Ac136ddd64DBa72') - # Output: ValidationError(func=eth_address, args=...) + ValidationError(func=eth_address, args={'value': '0x8Ba1f109551bD432803012645Ac136ddd64DBa72'}) Args: value: @@ -49,7 +49,7 @@ def eth_address(value: str, /): Returns: (Literal[True]): If `value` is a valid ethereum address. (ValidationError): If `value` is an invalid ethereum address. - """ + """ # noqa: E501 if not _keccak_flag: raise ImportError( "Do `pip install validators[crypto-eth-addresses]` to perform `eth_address` validation." diff --git a/src/validators/crypto_addresses/trx_address.py b/src/validators/crypto_addresses/trx_address.py index 3b021fbc..3ed9feb9 100644 --- a/src/validators/crypto_addresses/trx_address.py +++ b/src/validators/crypto_addresses/trx_address.py @@ -42,9 +42,9 @@ def trx_address(value: str, /): Examples: >>> trx_address('TLjfbTbpZYDQ4EoA4N5CLNgGjfbF8ZWz38') - # Output: True + True >>> trx_address('TR2G7Rm4vFqF8EpY4U5xdLdQ7XgJ2U8Vd') - # Output: ValidationError(func=trx_address, args=...) + ValidationError(func=trx_address, args={'value': 'TR2G7Rm4vFqF8EpY4U5xdLdQ7XgJ2U8Vd'}) Args: value: diff --git a/src/validators/domain.py b/src/validators/domain.py index 384ade0f..64a59b71 100644 --- a/src/validators/domain.py +++ b/src/validators/domain.py @@ -45,12 +45,12 @@ def domain( Examples: >>> domain('example.com') - # Output: True + True >>> domain('example.com/') - # Output: ValidationError(func=domain, ...) + ValidationError(func=domain, args={'value': 'example.com/'}) >>> # Supports IDN domains as well:: >>> domain('xn----gtbspbbmkef.xn--p1ai') - # Output: True + True Args: value: diff --git a/src/validators/email.py b/src/validators/email.py index eff09bd3..c9ac7323 100644 --- a/src/validators/email.py +++ b/src/validators/email.py @@ -31,9 +31,9 @@ def email( Examples: >>> email('someone@example.com') - # Output: True + True >>> email('bogus@@') - # Output: ValidationError(email=email, args={'value': 'bogus@@'}) + ValidationError(func=email, args={'value': 'bogus@@'}) Args: value: diff --git a/src/validators/encoding.py b/src/validators/encoding.py index 71efc849..2cb7c47a 100644 --- a/src/validators/encoding.py +++ b/src/validators/encoding.py @@ -13,9 +13,9 @@ def base16(value: str, /): Examples: >>> base16('a3f4b2') - # Output: True + True >>> base16('a3f4Z1') - # Output: ValidationError(func=base16, args={'value': 'a3f4Z1'}) + ValidationError(func=base16, args={'value': 'a3f4Z1'}) Args: value: @@ -34,9 +34,9 @@ def base32(value: str, /): Examples: >>> base32('MFZWIZLTOQ======') - # Output: True + True >>> base32('MfZW3zLT9Q======') - # Output: ValidationError(func=base32, args={'value': 'MfZW3zLT9Q======'}) + ValidationError(func=base32, args={'value': 'MfZW3zLT9Q======'}) Args: value: @@ -55,9 +55,9 @@ def base58(value: str, /): Examples: >>> base58('14pq6y9H2DLGahPsM4s7ugsNSD2uxpHsJx') - # Output: True + True >>> base58('cUSECm5YzcXJwP') - # Output: ValidationError(func=base58, args={'value': 'cUSECm5YzcXJwP'}) + True Args: value: @@ -76,9 +76,9 @@ def base64(value: str, /): Examples: >>> base64('Y2hhcmFjdGVyIHNldA==') - # Output: True + True >>> base64('cUSECm5YzcXJwP') - # Output: ValidationError(func=base64, args={'value': 'cUSECm5YzcXJwP'}) + ValidationError(func=base64, args={'value': 'cUSECm5YzcXJwP'}) Args: value: diff --git a/src/validators/finance.py b/src/validators/finance.py index 593aab9d..9df5a970 100644 --- a/src/validators/finance.py +++ b/src/validators/finance.py @@ -62,7 +62,7 @@ def cusip(value: str): >>> cusip('037833DP2') True >>> cusip('037833DP3') - ValidationFailure(func=cusip, ...) + ValidationError(func=cusip, args={'value': '037833DP3'}) Args: value: CUSIP string to validate. @@ -83,9 +83,9 @@ def isin(value: str): Examples: >>> isin('037833DP2') - True + ValidationError(func=isin, args={'value': '037833DP2'}) >>> isin('037833DP3') - ValidationFailure(func=isin, ...) + ValidationError(func=isin, args={'value': '037833DP3'}) Args: value: ISIN string to validate. @@ -108,7 +108,7 @@ def sedol(value: str): >>> sedol('2936921') True >>> sedol('29A6922') - ValidationFailure(func=sedol, ...) + ValidationError(func=sedol, args={'value': '29A6922'}) Args: value: SEDOL string to validate. diff --git a/src/validators/hashes.py b/src/validators/hashes.py index e544f7fe..2e9aee62 100644 --- a/src/validators/hashes.py +++ b/src/validators/hashes.py @@ -13,9 +13,9 @@ def md5(value: str, /): Examples: >>> md5('d41d8cd98f00b204e9800998ecf8427e') - # Output: True + True >>> md5('900zz11') - # Output: ValidationError(func=md5, args={'value': '900zz11'}) + ValidationError(func=md5, args={'value': '900zz11'}) Args: value: @@ -34,9 +34,9 @@ def sha1(value: str, /): Examples: >>> sha1('da39a3ee5e6b4b0d3255bfef95601890afd80709') - # Output: True + True >>> sha1('900zz11') - # Output: ValidationError(func=sha1, args={'value': '900zz11'}) + ValidationError(func=sha1, args={'value': '900zz11'}) Args: value: @@ -55,9 +55,9 @@ def sha224(value: str, /): Examples: >>> sha224('d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f') - # Output: True + True >>> sha224('900zz11') - # Output: ValidationError(func=sha224, args={'value': '900zz11'}) + ValidationError(func=sha224, args={'value': '900zz11'}) Args: value: @@ -79,9 +79,9 @@ def sha256(value: str, /): ... 'e3b0c44298fc1c149afbf4c8996fb924' ... '27ae41e4649b934ca495991b7852b855' ... ) - # Output: True + True >>> sha256('900zz11') - # Output: ValidationError(func=sha256, args={'value': '900zz11'}) + ValidationError(func=sha256, args={'value': '900zz11'}) Args: value: @@ -103,9 +103,9 @@ def sha384(value: str, /): ... 'cb00753f45a35e8bb5a03d699ac65007272c32ab0eded163' ... '1a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7' ... ) - # Output: True + True >>> sha384('900zz11') - # Output: ValidationError(func=sha384, args={'value': '900zz11'}) + ValidationError(func=sha384, args={'value': '900zz11'}) Args: value: @@ -128,9 +128,9 @@ def sha512(value: str, /): ... '9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af9' ... '27da3e' ... ) - # Output: True + True >>> sha512('900zz11') - # Output: ValidationError(func=sha512, args={'value': '900zz11'}) + ValidationError(func=sha512, args={'value': '900zz11'}) Args: value: diff --git a/src/validators/hostname.py b/src/validators/hostname.py index 7ad634ae..bdf6bdb0 100644 --- a/src/validators/hostname.py +++ b/src/validators/hostname.py @@ -64,25 +64,25 @@ def hostname( Examples: >>> hostname("ubuntu-pc:443") - # Output: True + True >>> hostname("this-pc") - # Output: True + True >>> hostname("xn----gtbspbbmkef.xn--p1ai:65535") - # Output: True + True >>> hostname("_example.com") - # Output: True + ValidationError(func=hostname, args={'value': '_example.com'}) >>> hostname("123.5.77.88:31000") - # Output: True + True >>> hostname("12.12.12.12") - # Output: True + True >>> hostname("[::1]:22") - # Output: True + True >>> hostname("dead:beef:0:0:0:0000:42:1") - # Output: True + True >>> hostname("[0:0:0:0:0:ffff:1.2.3.4]:-65538") - # Output: ValidationError(func=hostname, ...) + ValidationError(func=hostname, args={'value': '[0:0:0:0:0:ffff:1.2.3.4]:-65538'}) >>> hostname("[0:&:b:c:@:e:f::]:9999") - # Output: ValidationError(func=hostname, ...) + ValidationError(func=hostname, args={'value': '[0:&:b:c:@:e:f::]:9999'}) Args: value: diff --git a/src/validators/i18n/es.py b/src/validators/i18n/es.py index ad5011d0..4bc6bb6d 100644 --- a/src/validators/i18n/es.py +++ b/src/validators/i18n/es.py @@ -39,9 +39,9 @@ def es_cif(value: str, /): Examples: >>> es_cif('B25162520') - # Output: True + True >>> es_cif('B25162529') - # Output: ValidationError(func=es_cif, args=...) + ValidationError(func=es_cif, args={'value': 'B25162529'}) Args: value: @@ -91,9 +91,9 @@ def es_nif(value: str, /): Examples: >>> es_nif('26643189N') - # Output: True + True >>> es_nif('26643189X') - # Output: ValidationError(func=es_nif, args=...) + ValidationError(func=es_nif, args={'value': '26643189X'}) Args: value: @@ -122,9 +122,9 @@ def es_nie(value: str, /): Examples: >>> es_nie('X0095892M') - # Output: True + True >>> es_nie('X0095892X') - # Output: ValidationError(func=es_nie, args=...) + ValidationError(func=es_nie, args={'value': 'X0095892X'}) Args: value: @@ -154,9 +154,9 @@ def es_doi(value: str, /): Examples: >>> es_doi('X0095892M') - # Output: True + True >>> es_doi('X0095892X') - # Output: ValidationError(func=es_doi, args=...) + ValidationError(func=es_doi, args={'value': 'X0095892X'}) Args: value: diff --git a/src/validators/i18n/fi.py b/src/validators/i18n/fi.py index 243ee08f..e5973d50 100644 --- a/src/validators/i18n/fi.py +++ b/src/validators/i18n/fi.py @@ -42,9 +42,9 @@ def fi_business_id(value: str, /): Examples: >>> fi_business_id('0112038-9') # Fast Monkeys Ltd - # Output: True + True >>> fi_business_id('1234567-8') # Bogus ID - # Output: ValidationError(func=fi_business_id, ...) + ValidationError(func=fi_business_id, args={'value': '1234567-8'}) Args: value: @@ -75,9 +75,9 @@ def fi_ssn(value: str, /, *, allow_temporal_ssn: bool = True): Examples: >>> fi_ssn('010101-0101') - # Output: True + True >>> fi_ssn('101010-0102') - # Output: ValidationError(func=fi_ssn, args=...) + ValidationError(func=fi_ssn, args={'value': '101010-0102'}) Args: value: diff --git a/src/validators/i18n/fr.py b/src/validators/i18n/fr.py index 49d5830d..cba93bc1 100644 --- a/src/validators/i18n/fr.py +++ b/src/validators/i18n/fr.py @@ -30,19 +30,19 @@ def fr_department(value: typing.Union[str, int]): Examples: >>> fr_department(20) # can be an integer - # Output: True + ValidationError(func=fr_department, args={'value': 20}) >>> fr_department("20") - # Output: True + ValidationError(func=fr_department, args={'value': '20'}) >>> fr_department("971") # Guadeloupe - # Output: True + True >>> fr_department("00") - # Output: ValidationError(func=fr_department, args=...) + ValidationError(func=fr_department, args={'value': '00'}) >>> fr_department('2A') # Corsica - # Output: True + True >>> fr_department('2B') - # Output: True + True >>> fr_department('2C') - # Output: ValidationError(func=fr_department, args=...) + ValidationError(func=fr_department, args={'value': '2C'}) Args: value: @@ -75,13 +75,13 @@ def fr_ssn(value: str): Examples: >>> fr_ssn('1 84 12 76 451 089 46') - # Output: True + True >>> fr_ssn('1 84 12 76 451 089') # control key is optional - # Output: True + True >>> fr_ssn('3 84 12 76 451 089 46') # wrong gender number - # Output: ValidationError(func=fr_ssn, args=...) + ValidationError(func=fr_ssn, args={'value': '3 84 12 76 451 089 46'}) >>> fr_ssn('1 84 12 76 451 089 47') # wrong control key - # Output: ValidationError(func=fr_ssn, args=...) + ValidationError(func=fr_ssn, args={'value': '1 84 12 76 451 089 47'}) Args: value: diff --git a/src/validators/i18n/ind.py b/src/validators/i18n/ind.py index 625e3012..c1d49400 100644 --- a/src/validators/i18n/ind.py +++ b/src/validators/i18n/ind.py @@ -15,7 +15,7 @@ def ind_aadhar(value: str): >>> ind_aadhar('3675 9834 6015') True >>> ind_aadhar('3675 ABVC 2133') - ValidationFailure(func=aadhar, args={'value': '3675 ABVC 2133'}) + ValidationError(func=ind_aadhar, args={'value': '3675 ABVC 2133'}) Args: value: Aadhar card number string to validate. @@ -35,7 +35,7 @@ def ind_pan(value: str): >>> ind_pan('ABCDE9999K') True >>> ind_pan('ABC5d7896B') - ValidationFailure(func=pan, args={'value': 'ABC5d7896B'}) + ValidationError(func=ind_pan, args={'value': 'ABC5d7896B'}) Args: value: PAN card number string to validate. diff --git a/src/validators/iban.py b/src/validators/iban.py index 2b1a4d4d..da325ddb 100644 --- a/src/validators/iban.py +++ b/src/validators/iban.py @@ -25,9 +25,9 @@ def iban(value: str, /): Examples: >>> iban('DE29100500001061045672') - # Output: True + True >>> iban('123456') - # Output: ValidationError(func=iban, ...) + ValidationError(func=iban, args={'value': '123456'}) Args: value: diff --git a/src/validators/ip_address.py b/src/validators/ip_address.py index 1bb5d134..94a42c62 100644 --- a/src/validators/ip_address.py +++ b/src/validators/ip_address.py @@ -58,11 +58,11 @@ def ipv4( Examples: >>> ipv4('123.0.0.7') - # Output: True + True >>> ipv4('1.1.1.1/8') - # Output: True + True >>> ipv4('900.80.70.11') - # Output: ValidationError(func=ipv4, args={'value': '900.80.70.11'}) + ValidationError(func=ipv4, args={'value': '900.80.70.11'}) Args: value: @@ -105,11 +105,11 @@ def ipv6(value: str, /, *, cidr: bool = True, strict: bool = False, host_bit: bo Examples: >>> ipv6('::ffff:192.0.2.128') - # Output: True + True >>> ipv6('::1/128') - # Output: True + True >>> ipv6('abc.0.0.1') - # Output: ValidationError(func=ipv6, args={'value': 'abc.0.0.1'}) + ValidationError(func=ipv6, args={'value': 'abc.0.0.1'}) Args: value: diff --git a/src/validators/length.py b/src/validators/length.py index af9413ec..e49091d4 100644 --- a/src/validators/length.py +++ b/src/validators/length.py @@ -14,11 +14,11 @@ def length(value: str, /, *, min_val: Union[int, None] = None, max_val: Union[in Examples: >>> length('something', min_val=2) - # Output: True + True >>> length('something', min_val=9, max_val=9) - # Output: True + True >>> length('something', max_val=5) - # Output: ValidationError(func=length, ...) + ValidationError(func=length, args={'value': 'something', 'max_val': 5}) Args: value: diff --git a/src/validators/mac_address.py b/src/validators/mac_address.py index 5e5dd749..fd681b72 100644 --- a/src/validators/mac_address.py +++ b/src/validators/mac_address.py @@ -17,9 +17,9 @@ def mac_address(value: str, /): Examples: >>> mac_address('01:23:45:67:ab:CD') - # Output: True + True >>> mac_address('00:00:00:00:00') - # Output: ValidationError(func=mac_address, args={'value': '00:00:00:00:00'}) + ValidationError(func=mac_address, args={'value': '00:00:00:00:00'}) Args: value: diff --git a/src/validators/slug.py b/src/validators/slug.py index 2bd83d5b..2a02d206 100644 --- a/src/validators/slug.py +++ b/src/validators/slug.py @@ -16,9 +16,9 @@ def slug(value: str, /): Examples: >>> slug('my-slug-2134') - # Output: True + True >>> slug('my.slug') - # Output: ValidationError(func=slug, args={'value': 'my.slug'}) + ValidationError(func=slug, args={'value': 'my.slug'}) Args: value: Slug string to validate. diff --git a/src/validators/uri.py b/src/validators/uri.py index 03b64948..973f5ec2 100644 --- a/src/validators/uri.py +++ b/src/validators/uri.py @@ -27,9 +27,9 @@ def uri(value: str, /): Examples: >>> uri('mailto:example@domain.com') - # Output: True + True >>> uri('file:path.txt') - # Output: ValidationError(func=uri, ...) + ValidationError(func=uri, args={'value': 'file:path.txt'}) Args: value: diff --git a/src/validators/url.py b/src/validators/url.py index 30b7b028..6d455bb8 100644 --- a/src/validators/url.py +++ b/src/validators/url.py @@ -182,13 +182,13 @@ def url( Examples: >>> url('http://duck.com') - # Output: True + True >>> url('ftp://foobar.dk') - # Output: True + True >>> url('http://10.0.0.1') - # Output: True + True >>> url('http://example.com/">user@example.com') - # Output: ValidationError(func=url, ...) + ValidationError(func=url, args={'value': 'http://example.com/">user@example.com'}) Args: value: diff --git a/src/validators/utils.py b/src/validators/utils.py index 639de834..ad7543dc 100644 --- a/src/validators/utils.py +++ b/src/validators/utils.py @@ -53,9 +53,9 @@ def validator(func: Callable[..., Any]): ... def even(value): ... return not (value % 2) >>> even(4) - # Output: True + True >>> even(5) - # Output: ValidationError(func=even, args={'value': 5}) + ValidationError(func=even, args={'value': 5}) Args: func: diff --git a/src/validators/uuid.py b/src/validators/uuid.py index 336974d4..ca6b1ba0 100644 --- a/src/validators/uuid.py +++ b/src/validators/uuid.py @@ -19,9 +19,9 @@ def uuid(value: Union[str, UUID], /): Examples: >>> uuid('2bc1c94f-0deb-43e9-92a1-4775189ec9f8') - # Output: True + True >>> uuid('2bc1c94f 0deb-43e9-92a1-4775189ec9f8') - # Output: ValidationError(func=uuid, ...) + ValidationError(func=uuid, args={'value': '2bc1c94f 0deb-43e9-92a1-4775189ec9f8'}) Args: value: diff --git a/tests/test_url.py b/tests/test_url.py index fd846da0..2001a1d5 100644 --- a/tests/test_url.py +++ b/tests/test_url.py @@ -156,7 +156,7 @@ def test_returns_true_on_valid_private_url(value: str, private: Optional[bool]): ":// should fail", "http://foo.bar/foo(bar)baz quux", "http://-error-.invalid/", - "http://www.\uFFFD.ch", + "http://www.\ufffd.ch", "http://-a.b.co", "http://a.b-.co", "http://1.1.1.1.1",