Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_uri_with_everything_requiring_fragment(
self, uri_with_everything
):
uri = URIReference.from_string(uri_with_everything)
assert uri.is_valid(require_fragment=True) is True
def test_uri_with_everything(self, uri_with_everything):
uri = URIReference.from_string(uri_with_everything)
assert uri == self.to_tuple(uri_with_everything)
def test_basic_uris_with_paths_are_absolute(self, basic_uri_with_path):
uri = URIReference.from_string(basic_uri_with_path)
assert uri.is_absolute() is True
def test_uri_with_everything_raises_exception(self, uri_with_everything):
R = URIReference.from_string("foo/bar/bogus")
B = URIReference.from_string(uri_with_everything)
with pytest.raises(ResolutionError):
R.resolve_with(B)
def test_with_basic_uri_and_relative_path(self, basic_uri):
R = URIReference.from_string("foo/bar/bogus")
B = URIReference.from_string(basic_uri).normalize()
T = R.resolve_with(B)
assert T.scheme == B.scheme
assert T.host == B.host
assert T.path == "/" + R.path
def test_absolute_path_uri(self, absolute_path_uri):
uri = URIReference.from_string(absolute_path_uri)
assert uri == self.to_tuple(absolute_path_uri)
def test_with_basic_and_absolute_path_uris(
self, basic_uri, absolute_path_uri
):
R = URIReference.from_string(absolute_path_uri)
B = URIReference.from_string(basic_uri).normalize()
T = R.resolve_with(B)
assert T.scheme == B.scheme
assert T.host == B.host
assert T.path == R.path
def test_basic_uri(self, basic_uri):
uri = URIReference.from_string(basic_uri)
assert uri == self.to_tuple(basic_uri)
def test_uri_with_everything_raises_exception(self, uri_with_everything):
R = URIReference.from_string("foo/bar/bogus")
B = URIReference.from_string(uri_with_everything)
with pytest.raises(ResolutionError):
R.resolve_with(B)