Skip to content

Commit

Permalink
Normans review addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
konstntokas committed Oct 7, 2024
1 parent f96a11a commit 3d25072
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/webapi/ows/stac/test_controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,16 @@
}


def assert_equal_deep_dict(self, dict1, dict2):
def assert_equal_deep_dict(self, dict1, dict2, msg=None):
if msg is None:
msg = "Error occurred in key:"
for key in dict1:
if isinstance(dict1[key], dict):
assert_equal_deep_dict(self, dict1[key], dict2[key])
assert_equal_deep_dict(self, dict1[key], dict2[key], msg=f"{msg} {key},")
if hasattr(dict1[key], "__iter__"):
self.assertCountEqual(dict1[key], dict2[key])
self.assertCountEqual(dict1[key], dict2[key], msg=msg[:-1])
else:
self.assertEqual(dict1[key], dict2[key])
self.assertEqual(dict1[key], dict2[key], msg=msg[:-1])


class StacControllersTest(unittest.TestCase):
Expand Down
2 changes: 2 additions & 0 deletions xcube/util/jsonencoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ def _convert_default(obj: Any) -> Any:
elif np.issubdtype(obj.dtype, np.floating):
return float(obj)
elif np.issubdtype(obj.dtype, np.datetime64):
# np.datetime_as_string returns a np._str object;
# the str() then returns a str object.
return str(np.datetime_as_string(obj, timezone="UTC", unit="s"))
elif np.issubdtype(obj.dtype, np.str):
return str(obj)
Expand Down

0 comments on commit 3d25072

Please sign in to comment.