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 98d069e commit 4e0daff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions biosimulators_cobrapy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,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(
method_arg_change.kisao_id, str(exception).replace('\n', '\n ')),
Expand All @@ -143,7 +143,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(
method_arg_change.new_value, method_arg_change.kisao_id, str(exception).replace('\n', '\n ')),
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 @@ -219,7 +219,7 @@ def test_exec_sed_task_error_handling(self):
kisao_id='KISAO_0000437',
changes=[sedml_data_model.AlgorithmParameterChange(kisao_id='KISAO_0000553', new_value='GLPK2')]
))
with mock.patch.dict('os.environ', {'ALGORITHM_SUBSTITUTION_POLICY': 'SAME_METHOD'}):
with mock.patch.dict('os.environ', {'ALGORITHM_SUBSTITUTION_POLICY': 'NONE'}):
with self.assertRaisesRegex(CombineArchiveExecutionError, 'is not a valid'):
core.exec_sedml_docs_in_combine_archive(archive_filename, self.dirname)

Expand All @@ -232,7 +232,7 @@ def test_exec_sed_task_error_handling(self):
kisao_id='KISAO_0000528',
changes=[sedml_data_model.AlgorithmParameterChange(kisao_id='KISAO_0000531', 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(CombineArchiveExecutionError, 'not a valid value'):
core.exec_sedml_docs_in_combine_archive(archive_filename, self.dirname)

Expand All @@ -245,7 +245,7 @@ def test_exec_sed_task_error_handling(self):
kisao_id='KISAO_0000528',
changes=[sedml_data_model.AlgorithmParameterChange(kisao_id='KISAO_9999999', 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(CombineArchiveExecutionError, 'does not support parameter'):
core.exec_sedml_docs_in_combine_archive(archive_filename, self.dirname)

Expand Down

0 comments on commit 4e0daff

Please sign in to comment.