def test_asBytesModeFromUnicodeWithUnusableEncoding(self):
        """
        C{asBytesMode} with an C{encoding} argument that can't be used to encode
        the unicode path raises a L{UnicodeError}.
        """
        fp = filepath.FilePath(u"\u2603")
        with self.assertRaises(UnicodeError):
            fp.asBytesMode(encoding="ascii")

        C{asBytesMode} 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