def assert_failed(self, with_errors=False, with_warnings=None):
        """
        First, asserts that the error bundle registers a failure (recognizing
        whether warnings are acknowledged). Second, if with_errors is True,
        the presence of errors is asserted. If it is not true (default), it
        is tested that errors are not present. If with_warnings is not None,
        the presence of warnings is tested just like with_errors)
        """
        assert self.err.failed(fail_on_warnings=with_warnings or
                                                with_warnings is None), \
                "Test did not fail; failure was expected."

        if with_errors:
            assert self.err.errors, "Errors were expected."
        elif self.err.errors:
            raise AssertionError("Tests found unexpected errors: %s" %
                                self.err.print_summary(verbose=True))

        if with_warnings is not None:
            if with_warnings:
                assert self.err.warnings, "Warnings were expected."
            elif self.err.warnings:
                raise ("Tests found unexpected warnings: %s" %
                           self.err.print_summary())
dataset/ETHPy150Open mozilla/app-validator/tests/helper.py/TestCase.assert_failed/original