summaryrefslogtreecommitdiffstats
path: root/tests/test_parse.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:25:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:25:33 +0000
commit3c33e01482cb0481e2472ee49fa55b0d7f818c26 (patch)
treee1bc734976912ad573bb83e8c338bc3285afe50e /tests/test_parse.py
parentInitial commit. (diff)
downloadmdurl-3c33e01482cb0481e2472ee49fa55b0d7f818c26.tar.xz
mdurl-3c33e01482cb0481e2472ee49fa55b0d7f818c26.zip
Adding upstream version 0.1.2.upstream/0.1.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/test_parse.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_parse.py b/tests/test_parse.py
new file mode 100644
index 0000000..aa4ae44
--- /dev/null
+++ b/tests/test_parse.py
@@ -0,0 +1,26 @@
+import pytest
+
+from mdurl import parse
+from tests.fixtures.url import PARSED as FIXTURES
+
+
+def is_url_and_dict_equal(url, url_dict):
+ return (
+ url.protocol == url_dict.get("protocol")
+ and url.slashes == url_dict.get("slashes", False)
+ and url.auth == url_dict.get("auth")
+ and url.port == url_dict.get("port")
+ and url.hostname == url_dict.get("hostname")
+ and url.hash == url_dict.get("hash")
+ and url.search == url_dict.get("search")
+ and url.pathname == url_dict.get("pathname")
+ )
+
+
+@pytest.mark.parametrize(
+ "url,expected_dict",
+ FIXTURES.items(),
+)
+def test_parse(url, expected_dict):
+ parsed = parse(url)
+ assert is_url_and_dict_equal(parsed, expected_dict)