Skip to content

Commit

Permalink
updating for refactoring validation in biosimulators-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrkarr committed Apr 18, 2021
1 parent d32d3e7 commit 4c4b560
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 9 additions & 3 deletions biosimulators_cobrapy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,15 @@ def exec_sed_task(task, variables, log=None):
'''
log = log or TaskLog()

validation.validate_model_language(task.model.language, ModelLanguage.SBML)
validation.validate_model_change_types(task.model.changes, ())
validation.validate_simulation_type(task.simulation, (SteadyStateSimulation, ))
model = task.model
sim = task.simulation

raise_errors_warnings(validation.validate_model_language(task.model.language, ModelLanguage.SBML),
error_summary='Language for model `{}` is not supported.'.format(model.id))
raise_errors_warnings(validation.validate_model_change_types(task.model.changes, ()),
error_summary='Changes for model `{}` are not supported.'.format(model.id))
raise_errors_warnings(validation.validate_simulation_type(task.simulation, (SteadyStateSimulation, )),
error_summary='{} `{}` is not supported.'.format(sim.__class__.__name__, sim.id))
target_x_paths_ids = validation.validate_variable_xpaths(
variables, task.model.source, attr='id')
namespaces = get_namespaces_for_xml_doc(etree.parse(task.model.source))
Expand Down
4 changes: 1 addition & 3 deletions tests/test_core_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ def setUp(self):
self.dirname = tempfile.mkdtemp()

def tearDown(self):
#shutil.rmtree(self.dirname)
print(self.dirname)
shutil.rmtree(self.dirname)

def test_exec_sed_task_successfully(self):
task = sedml_data_model.Task(
Expand Down Expand Up @@ -263,7 +262,6 @@ def _build_combine_archive(self, model_changes=None, algorithm=None):
'archive.omex' if algorithm is None else 'archive-{}.omex'.format(algorithm.kisao_id))
CombineArchiveWriter().run(archive, archive_dirname, archive_filename)

print(archive_filename)
return (doc, archive_filename)

def _build_sed_doc(self, model_changes=None, algorithm=None):
Expand Down

0 comments on commit 4c4b560

Please sign in to comment.