def test_nameEncoding(self):
        """
        Passing L{unicode} to any function that takes a header name will encode
        said header name as ISO-8859-1.
        """
        h = Headers()

        # We set it using a Unicode string.
        h.setRawHeaders(u"\u00E1", [b"foo"])

        # It's encoded to the ISO-8859-1 value, which we can use to access it
        self.assertTrue(h.hasHeader(b"\xe1"))
        self.assertEqual(h.getRawHeaders(b"\xe1"), [b'foo'])

        # We can still access it using the Unicode string..
        self.assertTrue(h.hasHeader(u"\u00E1"))

        Passing L{unicode} to any function that takes a header name will encode
        said header name as ISO-8859-1.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_http_headers.py