Skip to content

Commit

Permalink
Adds catalogs metadata, closes #23
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Jeandet <[email protected]>
  • Loading branch information
jeandet committed Jun 28, 2022
1 parent 2a72c68 commit d00d4ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions speasy/webservices/amda/_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def dl_catalog(self, catalog_id: str, **kwargs):
catalog = load_catalog(url)
if catalog:
log.debug(f'Loaded catalog: id = {catalog_id}') # lgtm[py/clear-text-logging-sensitive-data]
catalog.meta.update(flat_inventories.amda.catalogs.get(catalog_id, SimpleNamespace()).__dict__)
else:
log.debug('Got None')
return catalog
Expand Down
6 changes: 6 additions & 0 deletions tests/test_amda_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ def test_catalog_shape(self):
def test_catalog_has_a_name(self):
self.assertIsNot(self.cat.name, "listOfICMEs_Nguyen")

def test_catalog_has_metadata(self):
self.assertIn('description', self.cat.meta)
self.assertIn('provider', self.cat.meta)
self.assertIn('nbIntervals', self.cat.meta)
self.assertIn('sharedBy', self.cat.meta)

def test_is_convertible_to_dataframe(self):
df = self.cat.to_dataframe()
self.assertTrue(len(df) > 0)
Expand Down

0 comments on commit d00d4ee

Please sign in to comment.