Skip to content

Commit

Permalink
fix bug on experimental/bare topics
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Aug 28, 2024
1 parent c8311f6 commit e99cbe8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pywis_topics/topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def _validate_esd_subtopic(self, esd_subtopic: str,

if strict:
LOGGER.debug('Validating subtopic with strict mode')
is_experimental = esd_subtopic.split('/')[1] == 'experimental'
is_experimental = '/experimental' in esd_subtopic
return esd_subtopic in self.topics[-1] or is_experimental

tokens = esd_subtopic.split('/')
Expand Down
6 changes: 6 additions & 0 deletions tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ def test_validate(self):
value = 'cache/a/wis2/ca-eccc-msc/data/core/weather/experimental/surface-based-observations' # noqa
self.assertTrue(self.th.validate(value))

value = 'origin/a/wis2/ca-eccc-msc/data/core/ocean' # noqa
self.assertTrue(self.th.validate(value))

value = 'cache/a/wis2/ca-eccc-msc/data/core/ocean' # noqa
self.assertTrue(self.th.validate(value))

value = 'cache/a/wis2/ca-eccc-msc/data/core/weather/surface-based-observations/#' # noqa
self.assertTrue(self.th.validate(value, strict=False))
self.assertFalse(self.th.validate(value))
Expand Down

0 comments on commit e99cbe8

Please sign in to comment.