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 eeef84a commit 75d327a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions biosimulators_boolnet/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def exec_sed_task(task, variables, log=None):
except NotImplementedError as exception:
if (
ALGORITHM_SUBSTITUTION_POLICY_LEVELS[algorithm_substitution_policy]
> ALGORITHM_SUBSTITUTION_POLICY_LEVELS[AlgorithmSubstitutionPolicy.SAME_METHOD]
> ALGORITHM_SUBSTITUTION_POLICY_LEVELS[AlgorithmSubstitutionPolicy.NONE]
):
warn('Unsuported algorithm parameter `{}` was ignored:\n {}'.format(
change.kisao_id, str(exception).replace('\n', '\n ')),
Expand All @@ -150,7 +150,7 @@ def exec_sed_task(task, variables, log=None):
except ValueError as exception:
if (
ALGORITHM_SUBSTITUTION_POLICY_LEVELS[algorithm_substitution_policy]
> ALGORITHM_SUBSTITUTION_POLICY_LEVELS[AlgorithmSubstitutionPolicy.SAME_METHOD]
> ALGORITHM_SUBSTITUTION_POLICY_LEVELS[AlgorithmSubstitutionPolicy.NONE]
):
warn('Unsuported value `{}` for algorithm parameter `{}` was ignored:\n {}'.format(
change.new_value, change.kisao_id, str(exception).replace('\n', '\n ')),
Expand Down
4 changes: 2 additions & 2 deletions tests/test_core_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def test_exec_sed_task_successfully(self):
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 @@ -148,7 +148,7 @@ def test_exec_sed_task_successfully(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 75d327a

Please sign in to comment.