Skip to content

Commit 496b83a

Browse files
committed
math.isfinite is only in Python 3 (still 1.0.3).
1 parent dc23bce commit 496b83a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/testspec.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ def stripNames(x):
7373
stripNames(xi)
7474

7575
for testresult in testresults:
76-
testresult["expr"] = testresult["expr"].replace('"round(withholes)"', 'named("round(withholes)", lambda x: round(x["withholes"]) if math.isfinite(x["withholes"]) else x["withholes"])')
77-
testresult["expr"] = testresult["expr"].replace('"[round(withholes), 2*round(withholes), 3*round(withholes)]"', 'named("[round(withholes), 2*round(withholes), 3*round(withholes)]", lambda x: [round(x["withholes"]), 2*round(x["withholes"]), 3*round(x["withholes"])] if math.isfinite(x["withholes"]) else [x["withholes"], x["withholes"], x["withholes"]])')
76+
if hasattr(math, "isfinite"):
77+
testresult["expr"] = testresult["expr"].replace('"round(withholes)"', 'named("round(withholes)", lambda x: round(x["withholes"]) if math.isfinite(x["withholes"]) else x["withholes"])')
78+
testresult["expr"] = testresult["expr"].replace('"[round(withholes), 2*round(withholes), 3*round(withholes)]"', 'named("[round(withholes), 2*round(withholes), 3*round(withholes)]", lambda x: [round(x["withholes"]), 2*round(x["withholes"]), 3*round(x["withholes"])] if math.isfinite(x["withholes"]) else [x["withholes"], x["withholes"], x["withholes"]])')
7879

7980
sys.stderr.write(testresult["expr"] + "\n")
8081

0 commit comments

Comments
 (0)