Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

py36+: remove workaround for Union[Pattern/Match] bug #7837

Merged
merged 1 commit into from Oct 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/_pytest/_code/code.py
Expand Up @@ -625,7 +625,7 @@ def getrepr(
)
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
representation of the exception using :func:`python:re.search`.

Expand Down
4 changes: 2 additions & 2 deletions src/_pytest/python_api.py
Expand Up @@ -562,7 +562,7 @@ def _is_numpy_array(obj: object) -> bool:
def raises(
expected_exception: Union["Type[_E]", Tuple["Type[_E]", ...]],
*,
match: "Optional[Union[str, Pattern[str]]]" = ...
match: Optional[Union[str, Pattern[str]]] = ...
) -> "RaisesContext[_E]":
...

Expand Down Expand Up @@ -740,7 +740,7 @@ def __init__(
self,
expected_exception: Union["Type[_E]", Tuple["Type[_E]", ...]],
message: str,
match_expr: Optional[Union[str, "Pattern[str]"]] = None,
match_expr: Optional[Union[str, Pattern[str]]] = None,
) -> None:
self.expected_exception = expected_exception
self.message = message
Expand Down
8 changes: 4 additions & 4 deletions src/_pytest/recwarn.py
Expand Up @@ -41,7 +41,7 @@ def recwarn() -> Generator["WarningsRecorder", None, None]:

@overload
def deprecated_call(
*, match: Optional[Union[str, "Pattern[str]"]] = ...
*, match: Optional[Union[str, Pattern[str]]] = ...
) -> "WarningsRecorder":
...

Expand Down Expand Up @@ -88,7 +88,7 @@ def deprecated_call( # noqa: F811
def warns(
expected_warning: Optional[Union["Type[Warning]", Tuple["Type[Warning]", ...]]],
*,
match: "Optional[Union[str, Pattern[str]]]" = ...
match: Optional[Union[str, Pattern[str]]] = ...
) -> "WarningsChecker":
...

Expand All @@ -106,7 +106,7 @@ def warns( # noqa: F811
def warns( # noqa: F811
expected_warning: Optional[Union["Type[Warning]", Tuple["Type[Warning]", ...]]],
*args: Any,
match: Optional[Union[str, "Pattern[str]"]] = None,
match: Optional[Union[str, Pattern[str]]] = None,
**kwargs: Any
) -> Union["WarningsChecker", Any]:
r"""Assert that code raises a particular class of warning.
Expand Down Expand Up @@ -236,7 +236,7 @@ def __init__(
expected_warning: Optional[
Union["Type[Warning]", Tuple["Type[Warning]", ...]]
] = None,
match_expr: Optional[Union[str, "Pattern[str]"]] = None,
match_expr: Optional[Union[str, Pattern[str]]] = None,
) -> None:
super().__init__()

Expand Down