Skip to content

Commit

Permalink
fix None type check and assert number
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfromearth committed Jan 2, 2025
1 parent 9304bd0 commit d6710a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions ncompare/getters.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,17 @@ def get_subgroups(node: Union[netCDF4.Dataset, netCDF4.Group, h5py.Group], file_
Returns
-------
list
list or None
subgroups under the node
"""
if file_type == "hdf5":
if node is None:
return []
elif file_type == "hdf5":
return [key for key in node.keys() if isinstance(node[key], h5py.Group)]
else: # should be "netcdf"
elif file_type == "netcdf": # should be "netcdf"
return list(node.groups)
else:
return []

Check warning on line 91 in ncompare/getters.py

View check run for this annotation

Codecov / codecov/patch

ncompare/getters.py#L91

Added line #L91 was not covered by tests


def get_variables(node: Union[netCDF4.Dataset, netCDF4.Group, h5py.Group], file_type: str) -> list:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ def test_icesat(temp_data_dir):
file_text=str(out_path),
)

assert num_differences == 4982
assert num_differences == 5280

0 comments on commit d6710a6

Please sign in to comment.