Fix lint flagged by pre-commit

This commit is contained in:
Jakob van Santen 2021-11-30 12:41:53 +01:00
parent 011706e462
commit 50d839c782
2 changed files with 7 additions and 7 deletions

View File

@ -444,10 +444,10 @@ class ApproxScalar(ApproxBase):
# NB: we need Complex, rather than just Number, to ensure that __abs__,
# __sub__, and __float__ are defined. Also, consider bool to be
# nonnumeric, even though it has the required arithmetic.
if not (
if isinstance(self.expected, bool) or not (
isinstance(self.expected, (Complex, Decimal))
and isinstance(actual, (Complex, Decimal))
) or isinstance(self.expected, bool):
):
return False
# Allow the user to control whether NaNs are considered equal to each

View File

@ -559,11 +559,11 @@ class TestApprox:
assert approx(x, rel=5e-6, abs=0) == a
assert approx(x, rel=5e-7, abs=0) != a
def test_bool(self):
assert True == approx(True)
assert False == approx(False)
assert True != approx(False)
assert True != approx(False, abs=2)
def test_expecting_bool(self):
assert True == approx(True) # noqa: E712
assert False == approx(False) # noqa: E712
assert True != approx(False) # noqa: E712
assert True != approx(False, abs=2) # noqa: E712
assert 1 != approx(True)
def test_list(self):