def test_unicode(self):
        """
        If a L{FlattenerError} is created with a unicode root, up to around 40
        characters from that string are included in the string representation
        of the exception.
        """
        # the response includes the output of repr(), which differs between
        # Python 2 and 3
        u = {'u': ''} if _PY3 else {'u': 'u'}
        self.assertEqual(
            str(error.FlattenerError(
                    RuntimeError("reason"), [u'abc\N{SNOWMAN}xyz'], [])),
            "Exception while flattening:\n"
            "  %(u)s'abc\\u2603xyz'\n" # Codepoint for SNOWMAN
            "RuntimeError: reason\n" % u)
        self.assertEqual(
            str(error.FlattenerError(
                    RuntimeError("reason"), [u'01234567\N{SNOWMAN}9' * 10],
                    [])),
            "Exception while flattening:\n"
            "  %(u)s'01234567\\u2603901234567\\u26039"
            "<...>01234567\\u2603901234567"
            "\\u26039'\n"
            "RuntimeError: reason\n" % u)

        If a L{FlattenerError} is created with a unicode root, up to around 40
        characters from that string are included in the string representation
        of the exception.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_error.py