Skip to content

Commit

Permalink
handle new numpy2 nan repr
Browse files Browse the repository at this point in the history
  • Loading branch information
bnavigator committed Aug 30, 2024
1 parent ddf9be4 commit 668cbfb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mayavi/tests/test_csv_sniff.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import tempfile
from unittest import SkipTest

from numpy import array, ndarray
from numpy import array, ndarray, isnan

from mayavi.tools.data_wizards.csv_sniff import \
Sniff, loadtxt, loadtxt_unknown, array2dict
Expand All @@ -33,8 +33,8 @@ def assertAllClose(self, x, y):

def assertClose(self, a, b):
if isinstance(a, (int, float)):
if repr(a) == 'nan':
self.assertTrue(repr(b) == 'nan')
if isnan(a):
self.assertTrue(isnan(b), '%r != %r' % (a ,b))
else:
self.assertTrue(abs(a - b) < 1e-6 * max(1, abs(a)),
'%r != %r %r' % (a, b, abs(a - b)))
Expand Down

0 comments on commit 668cbfb

Please sign in to comment.