def test_asTextModeFromBytesWithUnusableEncoding(self):
        """
        C{asTextMode} with an C{encoding} argument that can't be used to encode
        the unicode path raises a L{UnicodeError}.
        """
        fp = filepath.FilePath(b"\u2603")
        with self.assertRaises(UnicodeError):
            fp.asTextMode(encoding="utf-32")

        C{asTextMode} with an C{encoding} argument that can't be used to encode
        the unicode path raises a L{UnicodeError}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py