diff options
Diffstat (limited to 'absl/testing')
-rw-r--r-- | absl/testing/absltest.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/absl/testing/absltest.py b/absl/testing/absltest.py index 1ade38e..37b902e 100644 --- a/absl/testing/absltest.py +++ b/absl/testing/absltest.py @@ -1364,6 +1364,21 @@ class TestCase(unittest.TestCase): self.test_func(exc_value) return True + @typing.overload + def assertRaisesWithPredicateMatch( + self, expected_exception, predicate) -> _AssertRaisesContext: + # The purpose of this return statement is to work around + # https://github.com/PyCQA/pylint/issues/5273; it is otherwise ignored. + return self._AssertRaisesContext(None, None, None) + + @typing.overload + def assertRaisesWithPredicateMatch( + self, expected_exception, predicate, callable_obj: Callable[..., Any], + *args, **kwargs) -> None: + # The purpose of this return statement is to work around + # https://github.com/PyCQA/pylint/issues/5273; it is otherwise ignored. + return self._AssertRaisesContext(None, None, None) + def assertRaisesWithPredicateMatch(self, expected_exception, predicate, callable_obj=None, *args, **kwargs): """Asserts that exception is thrown and predicate(exception) is true. @@ -1392,6 +1407,22 @@ class TestCase(unittest.TestCase): with context: callable_obj(*args, **kwargs) + @typing.overload + def assertRaisesWithLiteralMatch( + self, expected_exception, expected_exception_message + ) -> _AssertRaisesContext: + # The purpose of this return statement is to work around + # https://github.com/PyCQA/pylint/issues/5273; it is otherwise ignored. + return self._AssertRaisesContext(None, None, None) + + @typing.overload + def assertRaisesWithLiteralMatch( + self, expected_exception, expected_exception_message, + callable_obj: Callable[..., Any], *args, **kwargs) -> None: + # The purpose of this return statement is to work around + # https://github.com/PyCQA/pylint/issues/5273; it is otherwise ignored. + return self._AssertRaisesContext(None, None, None) + def assertRaisesWithLiteralMatch(self, expected_exception, expected_exception_message, callable_obj=None, *args, **kwargs): |