def test_formatUnformattableErrorWithTraceback(self):
        """
        An event with an unformattable value in the C{log_format} key, that
        throws an exception when __repr__ is invoked still has a traceback
        appended.
        """
        try:
            raise CapturedError("This is a fake error")
        except CapturedError:
            f = Failure()

        event = {
            "log_format": "{evil()}",
            "evil": lambda: 1 / 0,
            Unformattable(): "gurk",
        }
        event["log_failure"] = f
        eventText = eventAsText(
            event,
            includeTimestamp=True,
            includeSystem=False
        )
        self.assertIsInstance(eventText, unicode)
        self.assertIn(u'MESSAGE LOST', eventText)
        self.assertIn(unicode(f.getTraceback()), eventText)
        self.assertIn(u'This is a fake error', eventText)

        An event with an unformattable value in the C{log_format} key, that
        throws an exception when __repr__ is invoked still has a traceback
        appended.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/test/test_format.py