Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def is_valid_url(url):
"""Validator that checks if a url is valid"""
return bool(validators.url(url))
def test_returns_true_on_valid_domain(value):
assert domain(value)
def test_returns_true_on_valid_ipv4_address(address):
assert ipv4(address)
assert not ipv6(address)
def test_valid_address_testnet(self, address, expected, description):
helpers.configurationhelpers.get_use_testnet = mock.MagicMock(return_value=True)
print(description)
assert validators.valid_address(address) == expected, description
def test_returns_failed_validation_on_invalid_mac_address(value):
assert isinstance(uuid(value), ValidationFailure)
def test_returns_true_on_valid_mac_address(value):
assert uuid(value)
def test_returns_failed_validation_on_invalid_email(value):
assert isinstance(fi_business_id(value), ValidationFailure)
def test_returns_failed_validation_on_invalid_range(value, min, max):
assert isinstance(
validators.length(value, min=min, max=max),
validators.ValidationFailure
)
def test_returns_failed_validation_on_invalid_range(value, min, max):
result = validators.between(value, min=min, max=max)
assert isinstance(result, validators.ValidationFailure)
def test_returns_failed_validation_on_invalid_url(address):
assert isinstance(url(address), ValidationFailure)