From 9c1b112c02ca7d4910b45cd078f4633789971eb2 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 20 Oct 2024 21:47:21 -1000 Subject: [PATCH] Add coverage for invalid IDNA encoding --- tests/test_url.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_url.py b/tests/test_url.py index 549449d44..c49985b51 100644 --- a/tests/test_url.py +++ b/tests/test_url.py @@ -212,6 +212,11 @@ def test_host_subcomponent_return_idna_encoded_host(): assert url.host_subcomponent == "xn----8sb1bdhvc.xn--j1amh" +def test_invalid_idna_hyphen_encoding(): + url = URL("http://x-----xn1agdj.tld") + assert url.host == "x-----xn1agdj.tld" + + def test_raw_host_non_ascii(): url = URL("http://оун-упа.укр") assert "xn----8sb1bdhvc.xn--j1amh" == url.raw_host