mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Accept AnyStr in unittest.assertRegex (#2315)
And also in assertNotRegex, assertRegexpMatches. Closes #2312.
This commit is contained in:
committed by
Guido van Rossum
parent
f582b53ff7
commit
c541077ffb
@@ -1,7 +1,7 @@
|
||||
# Stubs for unittest
|
||||
|
||||
from typing import (
|
||||
Any, Callable, Container, ContextManager, Dict, FrozenSet, Generic, Iterable,
|
||||
Any, AnyStr, Callable, Container, ContextManager, Dict, FrozenSet, Generic, Iterable,
|
||||
Iterator, List, NoReturn, Optional, overload, Pattern, Sequence, Set, TextIO,
|
||||
Tuple, Type, TypeVar, Union
|
||||
)
|
||||
@@ -111,9 +111,9 @@ class TestCase:
|
||||
def assertNotAlmostEqual(self, first: float, second: float,
|
||||
places: int = ..., msg: Any = ...,
|
||||
delta: float = ...) -> None: ...
|
||||
def assertRegex(self, text: str, regex: Union[str, Pattern[str]],
|
||||
def assertRegex(self, text: AnyStr, regex: Union[AnyStr, Pattern[AnyStr]],
|
||||
msg: Any = ...) -> None: ...
|
||||
def assertNotRegex(self, text: str, regex: Union[str, Pattern[str]],
|
||||
def assertNotRegex(self, text: AnyStr, regex: Union[AnyStr, Pattern[AnyStr]],
|
||||
msg: Any = ...) -> None: ...
|
||||
def assertCountEqual(self, first: Iterable[Any], second: Iterable[Any],
|
||||
msg: Any = ...) -> None: ...
|
||||
@@ -168,7 +168,7 @@ class TestCase:
|
||||
def assertNotAlmostEquals(self, first: float, second: float,
|
||||
places: int = ..., msg: Any = ...,
|
||||
delta: float = ...) -> None: ...
|
||||
def assertRegexpMatches(self, text: str, regex: Union[str, Pattern[str]],
|
||||
def assertRegexpMatches(self, text: AnyStr, regex: Union[AnyStr, Pattern[AnyStr]],
|
||||
msg: Any = ...) -> None: ...
|
||||
@overload
|
||||
def assertRaisesRegexp(self, # type: ignore
|
||||
|
||||
Reference in New Issue
Block a user