From 2be757bc937223c4da1cf707ad7b8f8ea366173c Mon Sep 17 00:00:00 2001 From: Stefano Borini <sborini@enthought.com> Date: Wed, 2 Aug 2017 15:52:54 +0100 Subject: [PATCH] Coverage --- .../tests/test_csv_extractor_data_source.py | 10 ++++++++++ .../tests/test_dummy_data_source.py | 13 ++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/force_bdss/core_plugins/dummy/csv_extractor/tests/test_csv_extractor_data_source.py b/force_bdss/core_plugins/dummy/csv_extractor/tests/test_csv_extractor_data_source.py index a498b9e..429b15a 100644 --- a/force_bdss/core_plugins/dummy/csv_extractor/tests/test_csv_extractor_data_source.py +++ b/force_bdss/core_plugins/dummy/csv_extractor/tests/test_csv_extractor_data_source.py @@ -1,6 +1,7 @@ import unittest from force_bdss.core.data_value import DataValue +from force_bdss.core.slot import Slot from force_bdss.core_plugins.dummy.csv_extractor.csv_extractor_data_source \ import CSVExtractorDataSource from force_bdss.core_plugins.dummy.csv_extractor.csv_extractor_model import \ @@ -50,3 +51,12 @@ class TestCSVExtractorDataSource(unittest.TestCase): model.column = 50 with self.assertRaises(IndexError): ds.run(model, mock_params) + + def test_slots(self): + ds = CSVExtractorDataSource(self.bundle) + model = CSVExtractorModel(self.bundle) + slots = ds.slots(model) + self.assertEqual(len(slots), 2) + self.assertEqual(len(slots[0]), 0) + self.assertEqual(len(slots[1]), 1) + self.assertIsInstance(slots[1][0], Slot) diff --git a/force_bdss/core_plugins/dummy/dummy_data_source/tests/test_dummy_data_source.py b/force_bdss/core_plugins/dummy/dummy_data_source/tests/test_dummy_data_source.py index a77e99a..ca6f2a3 100644 --- a/force_bdss/core_plugins/dummy/dummy_data_source/tests/test_dummy_data_source.py +++ b/force_bdss/core_plugins/dummy/dummy_data_source/tests/test_dummy_data_source.py @@ -1,8 +1,12 @@ import unittest +from force_bdss.core_plugins.dummy.dummy_data_source.dummy_data_source import \ + DummyDataSource +from force_bdss.core_plugins.dummy.dummy_data_source.dummy_data_source_model\ + import \ + DummyDataSourceModel from force_bdss.data_sources.base_data_source_bundle import \ BaseDataSourceBundle -from force_bdss.data_sources.tests.test_base_data_source import DummyDataSource try: import mock @@ -17,3 +21,10 @@ class TestDummyDataSource(unittest.TestCase): def test_initialization(self): ds = DummyDataSource(self.bundle) self.assertEqual(ds.bundle, self.bundle) + + def test_slots(self): + ds = DummyDataSource(self.bundle) + model = DummyDataSourceModel(self.bundle) + slots = ds.slots(model) + self.assertEqual(slots, ((), ())) + -- GitLab