Skip to content

Commit a67b93f

Browse files
author
Yuto Akutsu
committed
edit assert_close in sqlutils.py: support negative infinity
1 parent bf2179a commit a67b93f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/pyspark/testing/sqlutils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#
1717

1818
import datetime
19+
import math
1920
import os
2021
import shutil
2122
import tempfile
@@ -246,7 +247,7 @@ def function(self, *functions):
246247
@staticmethod
247248
def assert_close(a, b):
248249
c = [j[0] for j in b]
249-
diff = [abs(v - c[k]) < 1e-6 if v != math.inf else v == c[k]
250+
diff = [abs(v - c[k]) < 1e-6 if not math.isinf(v) else v == c[k]
250251
for k, v in enumerate(a)]
251252
return sum(diff) == len(a)
252253

0 commit comments

Comments
 (0)