diff options
| author | Bob Halley <halley@dnspython.org> | 2005-11-13 01:54:29 +0000 |
|---|---|---|
| committer | Bob Halley <halley@dnspython.org> | 2005-11-13 01:54:29 +0000 |
| commit | f4562106aad27e0f1c0049d62d91cb586603df91 (patch) | |
| tree | 4589c2533fee05e4cabe747c5de218cdafb82185 /tests | |
| parent | 21c309e91939d155e4728a1ffcee698635753df3 (diff) | |
| download | dnspython-f4562106aad27e0f1c0049d62d91cb586603df91.tar.gz | |
Preliminary Unicode support
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/name.py | 35 |
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() |
