def test_bad_url_with_suggestion(self, url): with pytest.raises(ValueError) as cm: inputs.url(url) assert text_type(cm.value) == '{0} is not a valid URL. Did you mean: http://{0}'.format(url)
def test_valid_url(self, url): assert inputs.url(url) == url
def test_bad_url(self, url): with pytest.raises(ValueError) as cm: inputs.url(url) assert text_type(cm.value).startswith('{0} is not a valid URL'.format(url))
def assert_bad_url(self, value): with assert_raises(ValueError) as cm: inputs.url(value) assert_equal(text_type(cm.exception), '{0} is not a valid URL'.format(value))
def assert_bad_url_with_suggestion(self, value): with assert_raises(ValueError) as cm: inputs.url(value) assert_equal(text_type(cm.exception), '{0} is not a valid URL. Did you mean: http://{0}'.format(value))
def assert_bad_url_with_suggestion(self, value): with assert_raises(ValueError) as cm: inputs.url(value) assert_equal( text_type(cm.exception), '{0} is not a valid URL. Did you mean: http://{0}'.format(value))