def test_2openTextMode(self):
        """
        The special built-in console file in Python 2 which has an 'encoding'
        attribute should qualify as a special type, since it accepts both bytes
        and text faithfully.
        """
        class VerySpecificLie(file):
            """
            In their infinite wisdom, the CPython developers saw fit not to
            allow us a writable 'encoding' attribute on the built-in 'file'
            type in Python 2, despite making it writable in C with
            PyFile_SetEncoding.

            Pretend they did not do that.
            """
            encoding = 'utf-8'

        self.assertEqual(ioType(VerySpecificLie(self.mktemp(), "wb")),
                          basestring)

        The special built-in console file in Python 2 which has an 'encoding'
        attribute should qualify as a special type, since it accepts both bytes
        and text faithfully.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_compat.py