diff --git a/tests/test_dataset.py b/tests/test_dataset.py index 0ba09d1f7..7d181b61a 100644 --- a/tests/test_dataset.py +++ b/tests/test_dataset.py @@ -24,9 +24,13 @@ def test_random_dataset_attrs(self): self.assertTrue(isinstance(dataset, GordoBaseDataset)) self.assertTrue(isinstance(dataset, RandomDataset)) self.assertTrue(hasattr(dataset, 'get_data')) + self.assertTrue(hasattr(dataset, 'get_metadata')) X, y = dataset.get_data() self.assertTrue(isinstance(X, np.ndarray)) # y can either be None or an numpy array self.assertTrue(isinstance(y, np.ndarray) or y is None) + + metadata = dataset.get_metadata() + self.assertTrue(isinstance(metadata,dict)) diff --git a/tests/test_influx_dataset.py b/tests/test_influx_dataset.py index 76fad6639..bfcd1b727 100644 --- a/tests/test_influx_dataset.py +++ b/tests/test_influx_dataset.py @@ -14,6 +14,7 @@ from click.testing import CliRunner from gordo_components.dataset._datasets import InfluxBackedDataset +from gordo_components.dataset import get_dataset import pytest @@ -146,3 +147,27 @@ def test__list_of_tags_from_influx_validate_tag_names(self): tags = set(list_of_tags) self.assertTrue(expected_tags==tags,msg=f'Expected tags = {expected_tags}' f'outputted {tags}') + + def test_influx_dataset_attrs(self): + """ + Test expected attributes + """ + from_ts = '2016-01-01T09:11:00+00:00' + to_ts = '2016-01-01T10:30:00+00:00' + from_ts = dateutil.parser.isoparse(from_ts) + to_ts = dateutil.parser.isoparse(to_ts) + influx_config = self.influx_config + tag_list = ['TRC-FIQ -23-0453N', 'TRC-FIQ -80-0303N', + 'TRC-FIQ -80-0703N', 'TRC-FIQ -80-0704N'] + config = { + 'type': 'influx', + 'from_ts': from_ts, + 'to_ts': to_ts, + 'influx_config': influx_config, + 'tag_list': tag_list + } + dataset = get_dataset(config) + self.assertTrue(hasattr(dataset, 'get_metadata')) + + metadata = dataset.get_metadata() + self.assertTrue(isinstance(metadata, dict))