summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2005-11-13 01:54:29 +0000
committerBob Halley <halley@dnspython.org>2005-11-13 01:54:29 +0000
commitf4562106aad27e0f1c0049d62d91cb586603df91 (patch)
tree4589c2533fee05e4cabe747c5de218cdafb82185 /tests
parent21c309e91939d155e4728a1ffcee698635753df3 (diff)
downloaddnspython-f4562106aad27e0f1c0049d62d91cb586603df91.tar.gz
Preliminary Unicode support
Diffstat (limited to 'tests')
-rw-r--r--tests/name.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/name.py b/tests/name.py
index cc7ced5..07e2c66 100644
--- a/tests/name.py
+++ b/tests/name.py
@@ -611,5 +611,40 @@ class NameTestCase(unittest.TestCase):
n.parent()
self.failUnlessRaises(dns.name.NoParent, bad)
+ def testFromUnicode1(self):
+ n = dns.name.from_text(u'foo.bar')
+ self.failUnless(n.labels == ('foo', 'bar', ''))
+
+ def testFromUnicode2(self):
+ n = dns.name.from_text(u'foo\u1234bar.bar')
+ self.failUnless(n.labels == ('xn--foobar-r5z', 'bar', ''))
+
+ def testFromUnicodeAlternateDot1(self):
+ n = dns.name.from_text(u'foo\u3002bar')
+ self.failUnless(n.labels == ('foo', 'bar', ''))
+
+ def testFromUnicodeAlternateDot2(self):
+ n = dns.name.from_text(u'foo\uff0ebar')
+ self.failUnless(n.labels == ('foo', 'bar', ''))
+
+ def testFromUnicodeAlternateDot3(self):
+ n = dns.name.from_text(u'foo\uff61bar')
+ self.failUnless(n.labels == ('foo', 'bar', ''))
+
+ def testToUnicode1(self):
+ n = dns.name.from_text(u'foo.bar')
+ s = n.to_unicode()
+ self.failUnless(s == u'foo.bar.')
+
+ def testToUnicode2(self):
+ n = dns.name.from_text(u'foo\u1234bar.bar')
+ s = n.to_unicode()
+ self.failUnless(s == u'foo\u1234bar.bar.')
+
+ def testToUnicode3(self):
+ n = dns.name.from_text('foo.bar')
+ s = n.to_unicode()
+ self.failUnless(s == u'foo.bar.')
+
if __name__ == '__main__':
unittest.main()