def getErrorFrames(self, test):
        """
        Run the given C{test}, make sure it fails and return the trimmed
        frames.

        @param test: The test case to run.

        @return: The C{list} of frames trimmed.
        """
        stream = NativeStringIO()
        result = reporter.Reporter(stream)
        test.run(result)
        bads = result.failures + result.errors
        self.assertEqual(len(bads), 1)
        self.assertEqual(bads[0][0], test)
        return result._trimFrames(bads[0][1].frames)

        Run the given C{test}, make sure it fails and return the trimmed
        frames.

        @param test: The test case to run.

        @return: The C{list} of frames trimmed.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/test/test_reporter.py