def addExpectedFailure(self, test, failure, todo):
        """
        Record an expected failure from a test.

        Some versions of subunit do not implement this. For those versions, we
        record a success.
        """
        failure = util.excInfoOrFailureToExcInfo(failure)
        addExpectedFailure = getattr(self._subunit, 'addExpectedFailure', None)
        if addExpectedFailure is None:
            self.addSuccess(test)
        else:
            addExpectedFailure(test, failure)

        Record an expected failure from a test.

        Some versions of subunit do not implement this. For those versions, we
        record a success.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/reporter.py