def test_models_list(self, mocker): models_form = SimulatorModelFragment() simulator = Simulator() simulator.model = ModelsEnum.EPILEPTOR.instance models_form.fill_from_trait(simulator) rendering_rules = SimulatorFragmentRenderingRules(is_model_fragment=True) soup = self.prepare_simulator_form_for_search(mocker, rendering_rules, form=models_form) select_field = soup.find_all('select') assert len(select_field) == 1, 'Number of select inputs is different than 1' select_field_options = soup.find_all('option') assert len(select_field_options) == len(ModelsEnum), 'Number of select field options != number of models' select_field_choice = soup.find_all('option', selected=True) assert len(select_field_choice) == 1 assert 'Epileptor' in select_field_choice[0].attrs['value']
def test_models_list(self): all_models_for_ui = get_ui_name_to_model() models_form = SimulatorModelFragment() simulator = Simulator() simulator.model = ModelsEnum.EPILEPTOR.get_class()() models_form.fill_from_trait(simulator) html = str(models_form) soup = BeautifulSoup(html) select_field = soup.find_all('select') assert len(select_field) == 1, 'Number of select inputs is different than 1' select_field_options = soup.find_all('option') assert len(select_field_options) == len(all_models_for_ui), 'Number of select field options != number of models' select_field_choice = soup.find_all('option', selected=True) assert len(select_field_choice) == 1 assert 'Epileptor' in select_field_choice[0].attrs['value']
def index(self): dynamic_gid = utils.generate_guid() model_name_fragment = _InputTreeFragment() model_fragment = SimulatorModelFragment() integrator_fragment = SimulatorIntegratorFragment() params = { 'title': "Dynamic model", 'mainContent': 'burst/dynamic', 'model_name_fragment': model_name_fragment, 'model_form': model_fragment, 'integrator_form': integrator_fragment, 'dynamic_gid': dynamic_gid } self.fill_default_attributes(params) dynamic = self.get_cached_dynamic(dynamic_gid) self._configure_integrator_noise(dynamic.integrator, dynamic.model) return params
def index(self): dynamic_gid = utils.generate_guid() model_name_fragment = _InputTreeFragment() model_fragment = self.algorithm_service.prepare_adapter_form(form_instance=SimulatorModelFragment()) integrator_fragment = self.algorithm_service.prepare_adapter_form(form_instance=SimulatorIntegratorFragment()) model_description = configure_matjax_doc(self.available_models) params = { 'title': "Dynamic model", 'mainContent': 'burst/dynamic', 'model_name_fragment': self.render_adapter_form(model_name_fragment), 'model_form': self.render_adapter_form(model_fragment), 'integrator_form': self.render_adapter_form(integrator_fragment), 'dynamic_gid': dynamic_gid, 'model_description': model_description } self.fill_default_attributes(params) dynamic = self.get_cached_dynamic(dynamic_gid) self._configure_integrator_noise(dynamic.integrator, dynamic.model) return params