From: Bob Halley Date: Sat, 5 Jan 2019 19:18:40 +0000 (-0800) Subject: Render type 0 in text as "TYPE0" not "NONE". [Issue #326] X-Git-Tag: v2.0.0rc1~379 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a82ec8bcbf3fe1cefdc62ab95956454dd0bff70a;p=thirdparty%2Fdnspython.git Render type 0 in text as "TYPE0" not "NONE". [Issue #326] --- diff --git a/dns/rdatatype.py b/dns/rdatatype.py index b247bc9c..e2a0dd68 100644 --- a/dns/rdatatype.py +++ b/dns/rdatatype.py @@ -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 diff --git a/tests/test_rdtypeandclass.py b/tests/test_rdtypeandclass.py index 5d940a01..bf96220f 100644 --- a/tests/test_rdtypeandclass.py +++ b/tests/test_rdtypeandclass.py @@ -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()