Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "rfc3986 in functional component" in Python

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'rfc3986' in functional components in Python. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

def test_unsplit_idna_a_unicode_hostname():
    parsed = urlparse(SNOWMAN_HOST)
    assert parsed.unsplit(use_idna=True) == SNOWMAN_IDNA_HOST
def test_finalize():
    """Verify the whole thing."""
    uri = (
        builder.URIBuilder()
        .add_scheme("https")
        .add_credentials("sigmavirus24", "not-my-re@l-password")
        .add_host("github.com")
        .add_path("sigmavirus24/rfc3986")
        .finalize()
        .unsplit()
    )
    expected = (
        "https://sigmavirus24:not-my-re%40l-password@github.com/"
        "sigmavirus24/rfc3986"
    )
    assert expected == uri
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()
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"
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
def test_encode_iri(iri, uri):
    assert rfc3986.iri_reference(iri).encode().unsplit() == uri
def test_from_parts(parts, unsplit):
    uri = pr.ParseResult.from_parts(*parts)
    assert uri.unsplit() == unsplit
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
        rfc3986.uri_reference("https://gitlab.com/sigmavirus24"),
        rfc3986.uri_reference("ssh://gitlab.com/sigmavirus24"),
        rfc3986.uri_reference("ssh://ssh@gitlab.com:22/sigmavirus24"),
        rfc3986.uri_reference("https://gitlab.com:443/sigmavirus24"),
        rfc3986.uri_reference("https://bitbucket.org/sigmavirus24"),
        rfc3986.uri_reference("ssh://bitbucket.org/sigmavirus24"),
        rfc3986.uri_reference("ssh://ssh@bitbucket.org:22/sigmavirus24"),
        rfc3986.uri_reference("https://bitbucket.org:443/sigmavirus24"),
        rfc3986.uri_reference("https://git.openstack.org/sigmavirus24"),
        rfc3986.uri_reference("ssh://git.openstack.org/sigmavirus24"),
        rfc3986.uri_reference("ssh://ssh@git.openstack.org:22/sigmavirus24"),
        rfc3986.uri_reference("https://git.openstack.org:443/sigmavirus24"),
        rfc3986.uri_reference(
            "ssh://ssh@git.openstack.org:22/sigmavirus24?foo=bar#fragment"
        ),
        rfc3986.uri_reference(
            "ssh://git.openstack.org:22/sigmavirus24?foo=bar#fragment"
def test_extend_query_with(uri, extend_with, expected_query):
    """Verify the behaviour of extend_query_with."""
    uribuilder = (
        builder.URIBuilder()
        .from_uri(uri_reference(uri))
        .extend_query_with(extend_with)
    )
    assert parse_qs(uribuilder.query) == expected_query

Is your System Free of Underlying Vulnerabilities?
Find Out Now