Merge pull request #7837 from asottile/py36_union_pattern_match
py36+: remove workaround for Union[Pattern/Match] bug
This commit is contained in:
commit
ced0a52a87
|
@ -625,7 +625,7 @@ class ExceptionInfo(Generic[_E]):
|
||||||
)
|
)
|
||||||
return fmt.repr_excinfo(self)
|
return fmt.repr_excinfo(self)
|
||||||
|
|
||||||
def match(self, regexp: "Union[str, Pattern[str]]") -> "Literal[True]":
|
def match(self, regexp: Union[str, Pattern[str]]) -> "Literal[True]":
|
||||||
"""Check whether the regular expression `regexp` matches the string
|
"""Check whether the regular expression `regexp` matches the string
|
||||||
representation of the exception using :func:`python:re.search`.
|
representation of the exception using :func:`python:re.search`.
|
||||||
|
|
||||||
|
|
|
@ -562,7 +562,7 @@ _E = TypeVar("_E", bound=BaseException)
|
||||||
def raises(
|
def raises(
|
||||||
expected_exception: Union["Type[_E]", Tuple["Type[_E]", ...]],
|
expected_exception: Union["Type[_E]", Tuple["Type[_E]", ...]],
|
||||||
*,
|
*,
|
||||||
match: "Optional[Union[str, Pattern[str]]]" = ...
|
match: Optional[Union[str, Pattern[str]]] = ...
|
||||||
) -> "RaisesContext[_E]":
|
) -> "RaisesContext[_E]":
|
||||||
...
|
...
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ class RaisesContext(Generic[_E]):
|
||||||
self,
|
self,
|
||||||
expected_exception: Union["Type[_E]", Tuple["Type[_E]", ...]],
|
expected_exception: Union["Type[_E]", Tuple["Type[_E]", ...]],
|
||||||
message: str,
|
message: str,
|
||||||
match_expr: Optional[Union[str, "Pattern[str]"]] = None,
|
match_expr: Optional[Union[str, Pattern[str]]] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.expected_exception = expected_exception
|
self.expected_exception = expected_exception
|
||||||
self.message = message
|
self.message = message
|
||||||
|
|
|
@ -41,7 +41,7 @@ def recwarn() -> Generator["WarningsRecorder", None, None]:
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def deprecated_call(
|
def deprecated_call(
|
||||||
*, match: Optional[Union[str, "Pattern[str]"]] = ...
|
*, match: Optional[Union[str, Pattern[str]]] = ...
|
||||||
) -> "WarningsRecorder":
|
) -> "WarningsRecorder":
|
||||||
...
|
...
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ def deprecated_call( # noqa: F811
|
||||||
def warns(
|
def warns(
|
||||||
expected_warning: Optional[Union["Type[Warning]", Tuple["Type[Warning]", ...]]],
|
expected_warning: Optional[Union["Type[Warning]", Tuple["Type[Warning]", ...]]],
|
||||||
*,
|
*,
|
||||||
match: "Optional[Union[str, Pattern[str]]]" = ...
|
match: Optional[Union[str, Pattern[str]]] = ...
|
||||||
) -> "WarningsChecker":
|
) -> "WarningsChecker":
|
||||||
...
|
...
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ def warns( # noqa: F811
|
||||||
def warns( # noqa: F811
|
def warns( # noqa: F811
|
||||||
expected_warning: Optional[Union["Type[Warning]", Tuple["Type[Warning]", ...]]],
|
expected_warning: Optional[Union["Type[Warning]", Tuple["Type[Warning]", ...]]],
|
||||||
*args: Any,
|
*args: Any,
|
||||||
match: Optional[Union[str, "Pattern[str]"]] = None,
|
match: Optional[Union[str, Pattern[str]]] = None,
|
||||||
**kwargs: Any
|
**kwargs: Any
|
||||||
) -> Union["WarningsChecker", Any]:
|
) -> Union["WarningsChecker", Any]:
|
||||||
r"""Assert that code raises a particular class of warning.
|
r"""Assert that code raises a particular class of warning.
|
||||||
|
@ -236,7 +236,7 @@ class WarningsChecker(WarningsRecorder):
|
||||||
expected_warning: Optional[
|
expected_warning: Optional[
|
||||||
Union["Type[Warning]", Tuple["Type[Warning]", ...]]
|
Union["Type[Warning]", Tuple["Type[Warning]", ...]]
|
||||||
] = None,
|
] = None,
|
||||||
match_expr: Optional[Union[str, "Pattern[str]"]] = None,
|
match_expr: Optional[Union[str, Pattern[str]]] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue