How to use the rfc3986.parseresult.ParseResultBytes.from_string function in rfc3986

To help you get started, we’ve selected a few rfc3986 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github python-hyper / rfc3986 / tests / test_parseresult.py View on Github external
def test_eager_normalization_from_string(self):
        uri = pr.ParseResultBytes.from_string(
            b"http://" + SNOWMAN + b".com/path",
            strict=False,
            lazy_normalize=False,
        )
        assert uri.unsplit() == b"http:/path"
github python-hyper / rfc3986 / tests / test_parseresult.py View on Github external
def test_unsplit(self):
        uri = pr.ParseResultBytes.from_string(
            b"http://" + SNOWMAN + b".com/path", strict=False
        )
        idna_encoded = SNOWMAN_IDNA_HOST.encode("utf-8") + b"/path"
        assert uri.unsplit(use_idna=True) == idna_encoded
github python-hyper / rfc3986 / tests / test_parseresult.py View on Github external
def test_copy_with_a_new_unicode_path(self, uri_with_everything):
        uri = pr.ParseResultBytes.from_string(uri_with_everything)
        pathbytes = b"/parse/result/tests/are/fun" + SNOWMAN
        new_uri = uri.copy_with(path=pathbytes.decode("utf-8"))
        assert new_uri.path == (b"/parse/result/tests/are/fun" + SNOWMAN)
github python-hyper / rfc3986 / tests / test_parseresult.py View on Github external
def test_handles_uri_with_everything(self, uri_with_everything):
        uri = pr.ParseResultBytes.from_string(uri_with_everything)
        assert uri.scheme == b"https"
        assert uri.path == b"/path/to/resource"
        assert uri.query == b"key=value"
        assert uri.fragment == b"fragment"
        assert uri.userinfo == b"user:pass"
        assert uri.port == 443
        assert isinstance(uri.authority, bytes) is True
github python-hyper / rfc3986 / tests / test_parseresult.py View on Github external
def test_raises_invalid_authority_for_invalid_uris(self, invalid_uri):
        with pytest.raises(exceptions.InvalidAuthority):
            pr.ParseResultBytes.from_string(invalid_uri)
github python-hyper / rfc3986 / tests / test_parseresult.py View on Github external
def test_copy_with_a_new_path(self, uri_with_everything):
        uri = pr.ParseResultBytes.from_string(uri_with_everything)
        new_uri = uri.copy_with(path=b"/parse/result/tests/are/fun")
        assert new_uri.path == b"/parse/result/tests/are/fun"