From: Casey Deccio Date: Sat, 25 Jun 2016 00:51:54 +0000 (-0400) Subject: Fix dns.name.Name.to_text() X-Git-Tag: v1.15.0~38^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19b440424ae1005d7278c2e8388ef5337af6cb90;p=thirdparty%2Fdnspython.git Fix dns.name.Name.to_text() Fix dns.name.Name.to_text(), so root is displayed properly. --- diff --git a/dns/name.py b/dns/name.py index 5d017a35..c30e58e0 100644 --- a/dns/name.py +++ b/dns/name.py @@ -387,7 +387,7 @@ class Name(object): if len(self.labels) == 0: return u'@' - if len(self.labels) == 1 and self.labels[0] == '': + if len(self.labels) == 1 and self.labels[0] == b'': return u'.' if omit_final_dot and self.is_absolute(): l = self.labels[:-1] diff --git a/tests/test_name.py b/tests/test_name.py index 645cf759..581459ac 100644 --- a/tests/test_name.py +++ b/tests/test_name.py @@ -242,6 +242,14 @@ class NameTestCase(unittest.TestCase): t = n.to_text() self.assertEqual(t, br'x80\.bar') + def testToText10(self): + t = dns.name.empty.to_unicode() + self.assertEqual(t, '@') + + def testToText11(self): + t = dns.name.root.to_unicode() + self.assertEqual(t, '.') + def testSlice1(self): n = dns.name.from_text(r'a.b.c.', origin=None) s = n[:]