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 e6c467af82.
This commit is contained in:
Jukka Lehtosalo
2019-11-01 15:48:35 +00:00
committed by GitHub
parent 4b8c6bbea1
commit 86135edb6d

View File

@@ -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,