Esempio n. 1
0
def test_url_join_chaining():
    assert url.URL("/foo") / "bar" / "foo" / "bar" == "/foo/bar/foo/bar"
Esempio n. 2
0
def test_rdiv_url():
    assert "/foo" / url.URL("/bar") == "/foo/bar"
Esempio n. 3
0
        (_abs, "http://www.foo.bar"),
        (_rel, "www.foo.bar"),
        (_orel, ""),
        (_dotl, _dotl),
    ],
)
def test_info_url(value: url.NetworkAddress, base):
    assert value.info.base == base
    assert value.info.address == value
    assert value.info.address_encoded == quote(value)


@pytest.mark.parametrize(
    argnames=("value", "path", "expected"),
    argvalues=[
        (url.URL("/foo"), "bar", "/foo/bar"),
        (url.URL("http://foo.bar/bar"), "foo", "http://foo.bar/bar/foo"),
        (url.URL("http://foo.bar:8080/bar"), "foo",
         "http://foo.bar:8080/bar/foo"),
    ],
)
def test_url_join(value, path, expected):
    assert value / path == expected


def test_url_join_chaining():
    assert url.URL("/foo") / "bar" / "foo" / "bar" == "/foo/bar/foo/bar"


def test_rdiv_url():
    assert "/foo" / url.URL("/bar") == "/foo/bar"