aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_codecs.py
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2024-03-15 07:38:13 -0700
committerGitHub <noreply@github.com>2024-03-15 15:38:13 +0100
commitd180b507c4929be399395bfd7946948f98ffc4f7 (patch)
tree51f22f7b3eb792dbe996a9c6bf26dabaffdf6fca /Lib/test/test_codecs.py
parentce2c996b2f645cd886d05f6ef8f1ba60ced7d4b7 (diff)
downloadcpython-d180b507c4929be399395bfd7946948f98ffc4f7.tar.gz
cpython-d180b507c4929be399395bfd7946948f98ffc4f7.zip
gh-63283: IDNA prefix should be case insensitive (GH-17726)
Any capitalization of "xn--" should be acceptable for the ACE prefix (see https://tools.ietf.org/html/rfc3490#section-5). Co-authored-by: Pepijn de Vos <pepijndevos@gmail.com> Co-authored-by: Erlend E. Aasland <erlend@python.org> Co-authored-by: Petr Viktorin <encukou@gmail.com>
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r--Lib/test/test_codecs.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index ff511a625a0..9585f947877 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -1547,6 +1547,13 @@ class IDNACodecTest(unittest.TestCase):
self.assertEqual(str(b"python.org.", "idna"), "python.org.")
self.assertEqual(str(b"xn--pythn-mua.org", "idna"), "pyth\xf6n.org")
self.assertEqual(str(b"xn--pythn-mua.org.", "idna"), "pyth\xf6n.org.")
+ self.assertEqual(str(b"XN--pythn-mua.org.", "idna"), "pyth\xf6n.org.")
+ self.assertEqual(str(b"xN--pythn-mua.org.", "idna"), "pyth\xf6n.org.")
+ self.assertEqual(str(b"Xn--pythn-mua.org.", "idna"), "pyth\xf6n.org.")
+ self.assertEqual(str(b"bugs.xn--pythn-mua.org.", "idna"),
+ "bugs.pyth\xf6n.org.")
+ self.assertEqual(str(b"bugs.XN--pythn-mua.org.", "idna"),
+ "bugs.pyth\xf6n.org.")
def test_builtin_encode(self):
self.assertEqual("python.org".encode("idna"), b"python.org")