'L{dns.Query.encode} returns a byte string representing the fields of the
query which can be decoded into a new L{dns.Query} instance using
L{dns.Query.decode}.'

def test_query(self):

    for n in self.names:
        for dnstype in range(1, 17):
            for dnscls in range(1, 5):
                f = BytesIO()
                dns.Query(n, dnstype, dnscls).encode(f)
                f.seek(0, 0)
                result = dns.Query()
                result.decode(f)
                self.assertEqual(result.name.name, n)
                self.assertEqual(result.type, dnstype)
                self.assertEqual(result.cls, dnscls)
