From 86135edb6d3422473db1b6d1c054f1c086b15850 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Fri, 1 Nov 2019 15:48:35 +0000 Subject: [PATCH] Fix signature of assertRaisesRegexp in unittest (#3434) 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 49217f596..7590407a9 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,