Skip to content

Commit 87e8f72

Browse files
committed
use np.isclose to compare variables in unittests
(sometimes there are insignificant changes in float variables)
1 parent f5ebb08 commit 87e8f72

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

test_aodntools/base_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def compare_variables(self, dataset, skip_vars=('source_file', 'instrument_id'))
6868
differences.append((var, "shapes differ"))
6969

7070
# compare the raw data arrays (not the masked_array)
71-
if not all(dataset[var][:].data == expected[var][:].data):
71+
if not all(np.isclose(dataset[var][:].data, expected[var][:].data)):
7272
differences.append((var, "variable values differ"))
7373

7474
self.assertEqual([], differences)

0 commit comments

Comments
 (0)