File: test_deconstruct_url.py

package info (click to toggle)
url-normalize 2.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 268 kB
  • sloc: python: 935; makefile: 16; sh: 8
file content (40 lines) | stat: -rw-r--r-- 1,054 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Deconstruct url tests."""

import pytest

from url_normalize.tools import URL, deconstruct_url


@pytest.mark.parametrize(
    ("url", "expected"),
    [
        (
            "http://site.com",
            URL(
                fragment="",
                host="site.com",
                path="",
                port="",
                query="",
                scheme="http",
                userinfo="",
            ),
        ),
        (
            "http://user@www.example.com:8080/path/index.html?param=val#fragment",
            URL(
                fragment="fragment",
                host="www.example.com",
                path="/path/index.html",
                port="8080",
                query="param=val",
                scheme="http",
                userinfo="user@",
            ),
        ),
    ],
)
def test_deconstruct_url_result_is_expected(url: str, expected: URL) -> None:
    """Assert we got expected results from the deconstruct_url function."""
    result = deconstruct_url(url)
    assert result == expected, url