From 3c7fbe2d8b4e3a0f3d9dcd7fbdf6ac12de181ef8 Mon Sep 17 00:00:00 2001 From: Anton Lodder Date: Fri, 25 Oct 2019 12:03:03 -0400 Subject: [PATCH] Document evaluating complex number for infinity --- src/_pytest/python_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)