'Test L{dns.Record_NAPTR} encode and decode.'

def test_NAPTR(self):

    naptrs = [(100, 10, 'u', 'sip+E2U', '!^.*$!sip:information@domain.tld!', ''), (100, 50, 's', 'http+I2L+I2C+I2R', '', '_http._tcp.gatech.edu')]
    for (order, preference, flags, service, regexp, replacement) in naptrs:
        rin = dns.Record_NAPTR(order, preference, flags, service, regexp, replacement)
        e = BytesIO()
        rin.encode(e)
        e.seek(0, 0)
        rout = dns.Record_NAPTR()
        rout.decode(e)
        self.assertEqual(rin.order, rout.order)
        self.assertEqual(rin.preference, rout.preference)
        self.assertEqual(rin.flags, rout.flags)
        self.assertEqual(rin.service, rout.service)
        self.assertEqual(rin.regexp, rout.regexp)
        self.assertEqual(rin.replacement.name, rout.replacement.name)
        self.assertEqual(rin.ttl, rout.ttl)
