From a82ec8bcbf3fe1cefdc62ab95956454dd0bff70a Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Sat, 5 Jan 2019 11:18:40 -0800 Subject: [PATCH] Render type 0 in text as "TYPE0" not "NONE". [Issue #326] --- dns/rdatatype.py | 3 +++ tests/test_rdtypeandclass.py | 3 +++ 2 files changed, 6 insertions(+) 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() -- 2.47.3