summaryrefslogtreecommitdiff
path: root/tests/test_name.py
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2016-09-29 08:25:50 -0700
committerBob Halley <halley@dnspython.org>2016-09-29 08:25:50 -0700
commitb2a91b619dae68e952ad8205ffa719b1676596fa (patch)
treed841d7f57843068d049a2c46ca4923174a67fed1 /tests/test_name.py
parentca9af3e157b1acc5802282df02dfc28500e98495 (diff)
downloaddnspython-b2a91b619dae68e952ad8205ffa719b1676596fa.tar.gz
Make IDNA default decode just decode the punycode.
Diffstat (limited to 'tests/test_name.py')
-rw-r--r--tests/test_name.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_name.py b/tests/test_name.py
index 999e5e4..f2a8773 100644
--- a/tests/test_name.py
+++ b/tests/test_name.py
@@ -722,6 +722,21 @@ class NameTestCase(unittest.TestCase):
self.assertEqual(str(n), 'xn--eckwd4c7c.xn--zckzah.')
self.assertEqual(s, u'ドメイン.テスト.')
+ def testDefaultDecodeIsJustPunycode(self):
+ # groß.com. in IDNA2008 form, pre-encoded.
+ n = dns.name.from_text('xn--gro-7ka.com')
+ # output using default codec which just decodes the punycode and
+ # doesn't test for IDNA2003 or IDNA2008.
+ self.assertEqual(n.to_unicode(), u'groß.com.')
+
+ def testStrictINDA2003Decode(self):
+ # groß.com. in IDNA2008 form, pre-encoded.
+ n = dns.name.from_text('xn--gro-7ka.com')
+ def bad():
+ # This throws in IDNA2003 because it doesn't "round trip".
+ n.to_unicode(idna_codec=dns.name.IDNA_2003_Strict)
+ self.failUnlessRaises(dns.name.IDNAException, bad)
+
def testReverseIPv4(self):
e = dns.name.from_text('1.0.0.127.in-addr.arpa.')
n = dns.reversename.from_address('127.0.0.1')