]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Render type 0 in text as "TYPE0" not "NONE". [Issue #326]
authorBob Halley <halley@dnspython.org>
Sat, 5 Jan 2019 19:18:40 +0000 (11:18 -0800)
committerBob Halley <halley@dnspython.org>
Sat, 5 Jan 2019 19:18:40 +0000 (11:18 -0800)
dns/rdatatype.py
tests/test_rdtypeandclass.py

index b247bc9c429ff76f1e523cb2f2d9297352f47117..e2a0dd689a0553874dd785f4464b713f90de7e7e 100644 (file)
@@ -170,6 +170,9 @@ _by_text = {
 # would cause the mapping not to be true inverse.
 
 _by_value = {y: x for x, y in _by_text.items()}
+# Render type 0 as "TYPE0" not "NONE", as NONE is a dnspython-ism and not
+# an official mnemonic.
+_by_value[0] = 'TYPE0'
 
 _metatypes = {
     OPT: True
index 5d940a01b9ebf4d2a02273eb282f181c8382f9fc..bf96220fbd07ae4f5a3260c597e206e5455f32ed 100644 (file)
@@ -121,5 +121,8 @@ class RdTypeAndClassTestCase(unittest.TestCase):
             dns.rdatatype.to_text(65536)
         self.failUnlessRaises(ValueError, bad)
 
+    def test_type0_totext(self):
+        self.failUnless(dns.rdatatype.to_text(0) == 'TYPE0')
+
 if __name__ == '__main__':
     unittest.main()