diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index 025a46076..52a91a905 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -227,7 +227,7 @@ class ApproxScalar(ApproxBase): """ # Infinities aren't compared using tolerances, so don't show a - # tolerance. + # tolerance. Need to call abs to handle complex numbers, e.g. (inf + 1j) if math.isinf(abs(self.expected)): return str(self.expected)