Skip to content

Commit

Permalink
update cmems tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aperrin66 committed Jan 24, 2025
1 parent 716ce0e commit 68e1d8e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/providers/test_cmems.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# pylint: disable=protected-access
"""Tests for the CMEMS provider"""
import logging
import unittest
import unittest.mock as mock
from datetime import datetime, timezone
Expand Down Expand Up @@ -554,17 +555,20 @@ def test_get_dataset_parameters(self):
'.get_cf_or_wkv_standard_name') as mock_get_cf_wkv, \
mock.patch('pythesint.vocabularies', vocabularies):

mock_get_cf_wkv.side_effect = ('variable_1', IndexError, IndexError)
mock_get_cf_wkv.side_effect = ('variable_1', IndexError, IndexError, 'variable_4')
vocabularies['cf_standard_name'].fuzzy_search.side_effect = (
IndexError, ['variable_3', 'varrriable_3'])

self.assertListEqual(
self.normalizer.get_dataset_parameters(DatasetInfo('foo', {
'variables': ({'standard_name': 'var1'},
{'standard_name': 'var2'},
{'standard_name': 'var3'})
})),
['variable_1', 'variable_3'])
with self.assertLogs(logger=self.normalizer.logger, level=logging.ERROR):
self.assertListEqual(
self.normalizer.get_dataset_parameters(DatasetInfo('foo', {
'variables': ({'standard_name': 'var1'},
{'standard_name': 'var2'},
{'standard_name': 'var3'},
{'short_name': 'v4'},
{'foo': 'bar'})
})),
['variable_1', 'variable_3', 'variable_4'])

def test_get_service(self):
"""Test retrieval of the type of repository where the data is
Expand Down

0 comments on commit 68e1d8e

Please sign in to comment.