def test_url_validate_fail(): f = URL() for value in ('not_a_url', 'otherthing'): with pytest.raises(FieldSet.Error): f._validate_pattern(f.regex, value)
def test_url_validate_pattern_use_first_found(): f = URL(use_first_found=True) for value in ('http://google.com/ncr', 'https://www.rebelmouse.com'): assert f._validate_pattern(f.regex, value) == value
def test_url_validate_pattern(): f = URL() for value in ('http://google.com/ncr', 'https://www.rebelmouse.com'): assert f._validate_pattern(f.regex, value)[0] == value