[pre-commit.ci] pre-commit autoupdate (#12115)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com> Co-authored-by: Ran Benita <ran@unusedvar.com>
This commit is contained in:
committed by
GitHub
parent
14437788f0
commit
c0532dda18
@@ -393,7 +393,7 @@ class ApproxScalar(ApproxBase):
|
||||
# tolerances, i.e. non-numerics and infinities. Need to call abs to
|
||||
# handle complex numbers, e.g. (inf + 1j).
|
||||
if (not isinstance(self.expected, (Complex, Decimal))) or math.isinf(
|
||||
abs(self.expected) # type: ignore[arg-type]
|
||||
abs(self.expected)
|
||||
):
|
||||
return str(self.expected)
|
||||
|
||||
@@ -437,8 +437,8 @@ class ApproxScalar(ApproxBase):
|
||||
# Allow the user to control whether NaNs are considered equal to each
|
||||
# other or not. The abs() calls are for compatibility with complex
|
||||
# numbers.
|
||||
if math.isnan(abs(self.expected)): # type: ignore[arg-type]
|
||||
return self.nan_ok and math.isnan(abs(actual)) # type: ignore[arg-type]
|
||||
if math.isnan(abs(self.expected)):
|
||||
return self.nan_ok and math.isnan(abs(actual))
|
||||
|
||||
# Infinity shouldn't be approximately equal to anything but itself, but
|
||||
# if there's a relative tolerance, it will be infinite and infinity
|
||||
@@ -446,11 +446,11 @@ class ApproxScalar(ApproxBase):
|
||||
# case would have been short circuited above, so here we can just
|
||||
# return false if the expected value is infinite. The abs() call is
|
||||
# for compatibility with complex numbers.
|
||||
if math.isinf(abs(self.expected)): # type: ignore[arg-type]
|
||||
if math.isinf(abs(self.expected)):
|
||||
return False
|
||||
|
||||
# Return true if the two numbers are within the tolerance.
|
||||
result: bool = abs(self.expected - actual) <= self.tolerance
|
||||
result: bool = abs(self.expected - actual) <= self.tolerance # type: ignore[arg-type]
|
||||
return result
|
||||
|
||||
# Ignore type because of https://github.com/python/mypy/issues/4266.
|
||||
@@ -769,8 +769,7 @@ def raises(
|
||||
expected_exception: Union[Type[E], Tuple[Type[E], ...]],
|
||||
*,
|
||||
match: Optional[Union[str, Pattern[str]]] = ...,
|
||||
) -> "RaisesContext[E]":
|
||||
...
|
||||
) -> "RaisesContext[E]": ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -779,8 +778,7 @@ def raises(
|
||||
func: Callable[..., Any],
|
||||
*args: Any,
|
||||
**kwargs: Any,
|
||||
) -> _pytest._code.ExceptionInfo[E]:
|
||||
...
|
||||
) -> _pytest._code.ExceptionInfo[E]: ...
|
||||
|
||||
|
||||
def raises(
|
||||
|
||||
Reference in New Issue
Block a user