def test_opt_short_lengths(self): with self.assertRaises(dns.exception.FormError): parser = dns.wire.Parser(bytes.fromhex('f00102')) OPT.from_wire_parser(4096, dns.rdatatype.OPT, parser) with self.assertRaises(dns.exception.FormError): parser = dns.wire.Parser(bytes.fromhex('f00100030000')) OPT.from_wire_parser(4096, dns.rdatatype.OPT, parser)
def test_opt_repr(self): opt = OPT(4096, dns.rdatatype.OPT, ()) self.assertEqual(repr(opt), '<DNS CLASS4096 OPT rdata: >')
def bad2(): parser = dns.wire.Parser(bytes.fromhex('f00100030000')) opt = OPT.from_wire_parser(4096, dns.rdatatype.OPT, parser)