From d58acff0a7e21da9c670897dbf6c5e20cb6fc971 Mon Sep 17 00:00:00 2001 From: martinRenou <martin.renou@gmail.com> Date: Thu, 24 Aug 2017 15:59:21 +0100 Subject: [PATCH] Finished to clean force_bdss/tests/test_core_evaluation_driver.py --- force_bdss/tests/probe_classes/mco.py | 6 +++++- force_bdss/tests/test_core_evaluation_driver.py | 14 +++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/force_bdss/tests/probe_classes/mco.py b/force_bdss/tests/probe_classes/mco.py index bc45f2f..89c2c2f 100644 --- a/force_bdss/tests/probe_classes/mco.py +++ b/force_bdss/tests/probe_classes/mco.py @@ -62,6 +62,8 @@ class ProbeMCOFactory(BaseMCOFactory): mco_class = Type(ProbeMCO) + nb_output_data_values = Int(0) + def create_model(self, model_data=None): if model_data is None: model_data = {} @@ -71,7 +73,9 @@ class ProbeMCOFactory(BaseMCOFactory): ) def create_communicator(self): - return self.communicator_class(self) + return self.communicator_class( + self, + nb_output_data_values=self.nb_output_data_values) def create_optimizer(self): return self.mco_class(self) diff --git a/force_bdss/tests/test_core_evaluation_driver.py b/force_bdss/tests/test_core_evaluation_driver.py index 1bbd535..6ca2c02 100644 --- a/force_bdss/tests/test_core_evaluation_driver.py +++ b/force_bdss/tests/test_core_evaluation_driver.py @@ -2,10 +2,8 @@ import unittest from force_bdss.tests.probe_classes.factory_registry_plugin import \ ProbeFactoryRegistryPlugin -from force_bdss.tests.probe_classes.mco import ( - ProbeMCOCommunicator, ProbeMCOFactory) -from force_bdss.tests.probe_classes.data_source import ( - ProbeDataSourceFactory) +from force_bdss.tests.probe_classes.mco import ProbeMCOFactory +from force_bdss.tests.probe_classes.data_source import ProbeDataSourceFactory from force_bdss.tests.probe_classes.kpi_calculator import ( ProbeKPICalculatorFactory) @@ -26,12 +24,6 @@ from force_bdss.core_evaluation_driver import CoreEvaluationDriver, \ _bind_data_values, _compute_layer_results -class OneValueMCOCommunicator(ProbeMCOCommunicator): - """A communicator that returns one single datavalue, for testing purposes. - """ - nb_output_data_values = 1 - - class TestCoreEvaluationDriver(unittest.TestCase): def setUp(self): self.factory_registry_plugin = ProbeFactoryRegistryPlugin() @@ -52,7 +44,7 @@ class TestCoreEvaluationDriver(unittest.TestCase): mco_factories = self.factory_registry_plugin.mco_factories mco_factories[0] = ProbeMCOFactory( None, - communicator_class=OneValueMCOCommunicator) + nb_output_data_values=1) driver = CoreEvaluationDriver( application=self.mock_application) with self.assertRaisesRegexp( -- GitLab