def convert(self, value, param, ctx): try: if not is_url(value): raise ValueError() return ComplexDataInput(value) except ValueError: self.fail('%s is not a valid URL' % value, param, ctx)
def test_is_url(): # noqa: D103 assert utils.is_url("http://localhost:5000/wps") assert utils.is_url("file:///path/to/my/file.txt") assert not utils.is_url("myfile.txt")
def test_is_url(): assert utils.is_url("http://localhost:5000/wps") assert utils.is_url("file:///path/to/my/file.txt") assert not utils.is_url("myfile.txt")