From 3e4268a6bc07c57fe0ac0602c9598f91d94871c5 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Fri, 1 Nov 2019 15:12:01 +0000 Subject: [PATCH] Fix signature of assertRaisesRegexp in unittest Fixes mypy false positive `"None" has noattribute "__enter__"` here: ``` class Foo(unittest.TestCase): def test_foo(self) -> None: with self.assertRaisesRegexp(Exception, "foo"): 1 / 0 ``` Fixes regression introduced in e6c467af8260d9569ca1d3bcb40c3b4bea3fe606. --- stdlib/3/unittest/case.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/3/unittest/case.pyi b/stdlib/3/unittest/case.pyi index 49217f59633e..7590407a9e1d 100644 --- a/stdlib/3/unittest/case.pyi +++ b/stdlib/3/unittest/case.pyi @@ -198,7 +198,7 @@ class TestCase: def assertRaisesRegexp(self, # type: ignore exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]], expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]], - callable: Callable[..., Any] = ..., + callable: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... @overload def assertRaisesRegexp(self,