def assertEncodedFormat(self, expectedEncoding, record):
        """
        Assert that encoding C{record} produces the expected bytes.

        @type record: L{dns.IEncodable}
        @param record: A record instance to encode

        @type expectedEncoding: L{bytes}
        @param expectedEncoding: The value which C{record.encode()}
            should produce.
        """
        stream = BytesIO()
        record.encode(stream)

        self.assertEqual(stream.getvalue(), expectedEncoding)

        Assert that encoding C{record} produces the expected bytes.

        @type record: L{dns.IEncodable}
        @param record: A record instance to encode

        @type expectedEncoding: L{bytes}
        @param expectedEncoding: The value which C{record.encode()}
            should produce.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/names/test/test_dns.py