def test_nameNotEncodable(self):
        """
        Passing L{unicode} to any function that takes a header name will encode
        said header name as ISO-8859-1, and if it cannot be encoded, it will
        raise a L{UnicodeDecodeError}.
        """
        h = Headers()

        # Only these two functions take names
        with self.assertRaises(UnicodeEncodeError):
            h.setRawHeaders(u"\u2603", [u"val"])

        with self.assertRaises(UnicodeEncodeError):
            h.hasHeader(u"\u2603")

        Passing L{unicode} to any function that takes a header name will encode
        said header name as ISO-8859-1, and if it cannot be encoded, it will
        raise a L{UnicodeDecodeError}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_http_headers.py