def setUp(self): register_all_tree_node_adapters() # Make a study and add all possible chromatography objects to the study # Make a study with 1 experiment self.study = make_sample_study(1) simulation = make_sample_simulation() self.study.simulations.append(simulation)
def setUp(self): # Register all views BaseModelViewTestCase.setUp(self) # This could be the manual creation of an instance of the ChromData to # represent. self.model = make_sample_study()
def setUp(self): self.datasource = SimpleDataSource() proj_data = dict(study=make_blank_study(), datasource=self.datasource) project = KromatographyProject(**proj_data) self.task = KromatographyTask(project=project) self.study2 = make_sample_study(num_exp=1) proj_data = dict(study=self.study2, datasource=self.datasource) project = KromatographyProject(**proj_data) self.task2 = KromatographyTask(project=project)
def test_tree_node_adaptation(self): register_all_tree_node_adapters() study = make_sample_study() data_manager = DataManager(data_elements=[study]) view = View( Item('data_elements', editor=TreeEditor()) ) ui = data_manager.edit_traits(view=view) ui.dispose()
def test_launch_app_for_study(self): # Make a study, and launch the app around it study = make_sample_study() self.gui.invoke_after(STARTUP_TIME_MS, self.gui.stop_event_loop) app = launch_app_for_study(study, splash_screen_duration=0., confirm_on_window_close=False, auto_close_empty_windows_on_open=True) self.assertIn(study, app.initial_studies) app.stop()
def setUp(self): super(TestKromatographyTaskRunRequest, self).setUp() self.datasource = SimpleDataSource() self.task = KromatographyTask() self.study2 = make_sample_study(num_exp=1) project_data = dict(study=self.study2, datasource=self.datasource, job_manager=self.job_manager) project = KromatographyProject(**project_data) self.task2 = KromatographyTask(project=project)
def load_study_with_exps_and_ran_sims(): """ Loads a study with two experiments and sims already ran. DEPRECATED: use kromatography.model.tests.sample_data_factories.make_sample_study instead. """ study = make_sample_study() exp1, sim1 = load_default_experiment_simulation(expt_id='Run_1') exp2, sim2 = load_default_experiment_simulation(expt_id='Run_2') study.experiments = [exp1, exp2] study.simulations = [sim1, sim2] return study
def setUp(self): self.standard_actions = [ DeleteAction, RenameAction, CopyAction, CutAction ] register_all_tree_node_adapters() # Make a study and add all possible chromatography objects to the study # Make a study with 1 experiment self.study = make_sample_study(1) simulation = make_sample_simulation() self.study.simulations.append(simulation) self.user_ds = make_sample_user_ds(with_bind_trans=True) self.user_ds_entries = self.user_ds.object_catalog.keys() self.user_ds_objects = [ getattr(self.user_ds, key) for key in self.user_ds_entries ] self.study.study_datasource.binding_models.\ append(self.study.simulations[0].binding_model) self.study.study_datasource.transport_models.\ append(self.study.simulations[0].transport_model) in_study_ds = self.study.study_datasource self.in_study_ds_entries = in_study_ds.object_catalog.keys() self.in_study_objects = [ getattr(in_study_ds, key) for key in self.in_study_ds_entries ]
def test_StudyDataSourceEntryCreator(self): study = make_sample_study() for key in STUDY_DATASOURCE_OBJECT_FACTORIES: creator = StudyDataSourceEntryCreator(study=study, datasource_key=key) self.assertCreatorValid(creator, key)
def test_prepare_study_datasource_catalog(self): study = make_sample_study() prepare_study_datasource_catalog(study) ds = study.study_datasource self.assertCreatorOnAllEntries(ds)
def setUp(self): self.model = make_sample_study() self.klass = Study
def setUp(self): register_all_tree_node_adapters() self.study = make_sample_study() self.model = make_sample_simulation() self.study.simulations.append(self.model)
def setUp(self): BaseStudyTestCase.setUp(self) self.study_class = Study self.study = make_sample_study() self.constructor_data = STUDY_DATA
def _get_can_create(self): can_create = self.experiment_selected and self.transport_model and \ self.binding_model return can_create def generate_sim_names(expt_names, study): """ Generate a list of simulation names for experiment names provided which are not already present in the study's existing simulations. """ names = [] existing_sim_names = [sim.name for sim in study.simulations] for expt in expt_names: candidate = generate_sim_name(expt) candidate = add_suffix_if_exists(candidate, existing_sim_names) names.append(candidate) return names if __name__ == "__main__": from kromatography.model.tests.sample_data_factories import \ make_sample_study study = make_sample_study(num_exp=5) sim_builder = SimulationFromExperimentBuilder( experiment_selector=ExperimentSelector(study=study), target_study=study, ) sim_builder.configure_traits() print("selected: {}".format(sim_builder.experiment_selected))
def setUp(self): GuiTestAssistant.setUp(self) self.study2 = make_sample_study(num_exp=1)
def _get_column(self): return self._get_object_clone_from_name("columns", self.column_name) def _get_product(self): return self._get_object_clone_from_name("products", self.product_name) def _get_method(self): if self.method_name: method = self._get_object_clone_from_name("methods", self.method_name) method.initial_buffer = self.initial_buffer return method def _get_step_names(self): if self.method_name: return [step.name for step in self.method.method_steps] else: return [] if __name__ == "__main__": from kromatography.model.data_source import SimpleDataSource from kromatography.model.tests.sample_data_factories import \ make_sample_study study = make_sample_study() sim_builder = SimulationFromDatasourceBuilder( datasource=SimpleDataSource(), study_datasource=study.study_datasource ) sim_builder.configure_traits()
from unittest import TestCase from traits.testing.unittest_tools import UnittestTools from app_common.traits.assertion_utils import assert_has_traits_almost_equal from kromatography.ui.simulation_from_experiment_builder import \ generate_sim_names, SimulationFromExperimentBuilder from kromatography.model.factories.simulation import generate_sim_name from kromatography.model.tests.sample_data_factories import \ make_sample_study, make_sample_study2 from kromatography.ui.experiment_selector import ExperimentSelector from kromatography.model.api import BindingModel, Buffer, Method, \ Simulation, TransportModel STUDY = make_sample_study(num_exp=5) class TestGenerateSimNames(TestCase): def test_1_name(self): self.assertIsInstance(generate_sim_name("Run 1"), str) self.assertIsInstance(generate_sim_name("Run_1"), str) def test_n_names(self): names = generate_sim_names(["Run 1", "Run 2"], STUDY) self.assertIsInstance(names, list) for name in names: self.assertIsInstance(name, str) class TestSimulationFromExperimentBuilder(TestCase, UnittestTools): @classmethod
def setUp(self): self.study = make_sample_study(num_exp=5) self.sim_builder = SimulationFromExperimentBuilder( experiment_selector=ExperimentSelector(study=self.study), target_study=self.study, )