How to use the rfc3986.parseresult.ParseResult 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_uri_with_everything(self, uri_with_everything):
        uri = pr.ParseResult.from_string(uri_with_everything)
        assert uri.host == uri.hostname
        assert uri.netloc == uri.authority
        assert uri.query == uri.params
        assert uri.geturl() == uri.unsplit()
github python-hyper / rfc3986 / tests / test_parseresult.py View on Github external
def test_from_parts(parts, unsplit):
    uri = pr.ParseResult.from_parts(*parts)
    assert uri.unsplit() == unsplit
github python-hyper / rfc3986 / tests / test_parseresult.py View on Github external
b"https://httpbin.org:443/get",
        ),
        (("HTTPS", None, "HTTPBIN.ORG"), b"https://httpbin.org"),
    ],
)
def test_bytes_from_parts(parts, unsplit):
    uri = pr.ParseResultBytes.from_parts(*parts)
    assert uri.unsplit() == unsplit


class TestParseResultParsesURIs(base.BaseTestParsesURIs):
    test_class = pr.ParseResult


class TestParseResultUnsplits(base.BaseTestUnsplits):
    test_class = pr.ParseResult


def test_normalizes_uris_when_using_from_string(uri_to_normalize):
    """Verify we always get the same thing out as we expect."""
    result = pr.ParseResult.from_string(
        uri_to_normalize, lazy_normalize=False
    )
    assert result.scheme == "https"
    assert result.host == "example.com"


class TestStdlibShims:
    def test_uri_with_everything(self, uri_with_everything):
        uri = pr.ParseResult.from_string(uri_with_everything)
        assert uri.host == uri.hostname
        assert uri.netloc == uri.authority
github python-hyper / rfc3986 / tests / test_parseresult.py View on Github external
def test_creates_a_copy_with_a_new_path(uri_with_everything):
    uri = pr.ParseResult.from_string(uri_with_everything)
    new_uri = uri.copy_with(path="/parse/result/tests/are/fun")
    assert new_uri.path == "/parse/result/tests/are/fun"
github python-hyper / rfc3986 / tests / test_unicode_support.py View on Github external
def test_strict_urlparsing():
    with pytest.raises(exceptions.InvalidAuthority):
        parseresult.ParseResult.from_string(SNOWMAN_HOST)