Skip to content

Commit

Permalink
update test to test for nan
Browse files Browse the repository at this point in the history
  • Loading branch information
sliu008 committed Nov 6, 2023
1 parent 4703d29 commit 5a55c97
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion add_collection_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,15 @@ def verify_variables(merged_group, origin_group, subset_index, both_merged):
merged_data = np.resize(merged_var[subset_index], origin_var.shape)
origin_data = origin_var

equal_nan = True
if merged_data.dtype.kind == 'S':
equal_nan = False

# verify variable data
if isinstance(origin_data, str):
unittest.TestCase().assertEqual(merged_data, origin_data)
else:
unittest.TestCase().assertTrue(np.array_equal(merged_data, origin_data, equal_nan=True))
unittest.TestCase().assertTrue(np.array_equal(merged_data, origin_data, equal_nan=equal_nan))


def verify_groups(merged_group, origin_group, subset_index, file=None, both_merged=False):
Expand Down Expand Up @@ -221,6 +225,7 @@ def test(collection_id, venue):
print('\nDone downloading.')

filename = file_names[0]

# Handle time dimension and variables dropping
merge_dataset = nc.Dataset(filename, 'r')

Expand Down

0 comments on commit 5a55c97

Please sign in to comment.