def test_formatFlatEventBadFormat(self):
        """
        If the format string is invalid, an error is produced.
        """
        event1 = dict(
            log_format=(
                "strrepr: {string!X}"
            ),
            string="hello",
        )

        flattenEvent(event1)
        event2 = json.loads(json.dumps(event1))

        self.assertTrue(
            formatEvent(event2).startswith(u"Unable to format event")
        )

        If the format string is invalid, an error is produced.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/test/test_flatten.py