def test_readTruncated(self):
        """
        If the JSON text for a record is truncated, skip it.
        """
        with StringIO(
            u'\x1e{"x": 1'
            u'\x1e{"y": 2}\n'
        ) as fileHandle:
            events = eventsFromJSONLogFile(fileHandle)

            self.assertEqual(next(events), {u"y": 2})
            self.assertRaises(StopIteration, next, events)  # No more events

            # We should have logged the lost record
            self.assertEqual(len(self.errorEvents), 1)
            self.assertEqual(
                self.errorEvents[0]["log_format"],
                u"Unable to read truncated JSON record: {record!r}"
            )
            self.assertEqual(self.errorEvents[0]["record"], b'{"x": 1')

        If the JSON text for a record is truncated, skip it.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/test/test_json.py