From 7175383f7d22cb48ffe1f701b0b440dce9e2c261 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 21 Oct 2024 07:57:05 -1000 Subject: [PATCH] Add test coverage for creating URLs from pre-encodeded str (#1370) --- tests/test_url.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_url.py b/tests/test_url.py index 568ae27a..082be22f 100644 --- a/tests/test_url.py +++ b/tests/test_url.py @@ -1977,6 +1977,19 @@ def test_split_result_encoded(): assert str(url) == "http://example.com/path?qs#frag" +def test_str_encoded(): + url = URL("http://example.com/path?qs#frag%2F%2D", encoded=True) + assert str(url) == "http://example.com/path?qs#frag%2F%2D" + + +def test_subclassed_str_encoded(): + class S(str): + """Subclass of str.""" + + url = URL(S("http://example.com/path?qs#frag%2F%2D"), encoded=True) + assert str(url) == "http://example.com/path?qs#frag%2F%2D" + + def test_human_repr(): url = URL("http://бажан:пароль@хост.домен:8080/шлях/сюди?арг=вал#фраг") s = url.human_repr()