Skip to content

Commit

Permalink
implementing ignoring parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrkarr committed May 3, 2021
1 parent 86b3e4d commit a4321a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions biosimulators_pysces/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def exec_sed_task(task, variables, log=None):
if setting is None:
if (
ALGORITHM_SUBSTITUTION_POLICY_LEVELS[algorithm_substitution_policy]
<= ALGORITHM_SUBSTITUTION_POLICY_LEVELS[AlgorithmSubstitutionPolicy.SAME_METHOD]
<= ALGORITHM_SUBSTITUTION_POLICY_LEVELS[AlgorithmSubstitutionPolicy.NONE]
):
msg = "".join([
"Algorithm parameter with KiSAO id '{}' is not supported. ".format(change.kisao_id),
Expand All @@ -155,7 +155,7 @@ def exec_sed_task(task, variables, log=None):
if not validate_str_value(value, setting['type']):
if (
ALGORITHM_SUBSTITUTION_POLICY_LEVELS[algorithm_substitution_policy]
<= ALGORITHM_SUBSTITUTION_POLICY_LEVELS[AlgorithmSubstitutionPolicy.SAME_METHOD]
<= ALGORITHM_SUBSTITUTION_POLICY_LEVELS[AlgorithmSubstitutionPolicy.NONE]
):
msg = "'{}' is not a valid {} value for parameter {}".format(
value, setting['type'].name, change.kisao_id)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_core_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_exec_sed_task_successfully(self):
self.assertFalse(numpy.any(numpy.isnan(results)))

def test_exec_sed_task_error_handling(self):
with mock.patch.dict('os.environ', {'ALGORITHM_SUBSTITUTION_POLICY': 'SAME_METHOD'}):
with mock.patch.dict('os.environ', {'ALGORITHM_SUBSTITUTION_POLICY': 'NONE'}):
task = sedml_data_model.Task(
model=sedml_data_model.Model(
source=os.path.join(os.path.dirname(__file__), 'fixtures', 'biomd0000000002.xml'),
Expand Down Expand Up @@ -216,7 +216,7 @@ def test_exec_sed_task_error_handling(self):
variables = []

task.simulation.algorithm.changes[0].new_value = 'not a number'
with mock.patch.dict('os.environ', {'ALGORITHM_SUBSTITUTION_POLICY': 'SAME_METHOD'}):
with mock.patch.dict('os.environ', {'ALGORITHM_SUBSTITUTION_POLICY': 'NONE'}):
with self.assertRaisesRegex(ValueError, 'is not a valid'):
core.exec_sed_task(task, variables)

Expand All @@ -225,7 +225,7 @@ def test_exec_sed_task_error_handling(self):
core.exec_sed_task(task, variables)

task.simulation.algorithm.changes[0].kisao_id = 'KISAO_9999999'
with mock.patch.dict('os.environ', {'ALGORITHM_SUBSTITUTION_POLICY': 'SAME_METHOD'}):
with mock.patch.dict('os.environ', {'ALGORITHM_SUBSTITUTION_POLICY': 'NONE'}):
with self.assertRaisesRegex(NotImplementedError, 'is not supported'):
core.exec_sed_task(task, variables)

Expand Down

0 comments on commit a4321a1

Please sign in to comment.