Пример #1
0
 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)
Пример #2
0
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")
Пример #3
0
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")