Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Meisrimel authored and Peter Meisrimel committed Oct 30, 2024
1 parent 8d62f61 commit eda3a4b
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions tests/test_fmi_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,29 +457,20 @@ def test_error_check_invalid_value(self):
models, connections = self._load_basic_simulation()
test_values = [1/2, 1/3, "0.5", False]

# TODO: tidy up with pytest
expected_substr = "Option 'result_downsampling_factor' must be an integer,"
## TODO: Pytest parametrization
for value in test_values:
try:
with pytest.raises(Exception, match = expected_substr):
self._sim_basic_simulation(models, connections, {'result_downsampling_factor': value})
error_raised = False
except FMUException as e:
error_raised = True
assert expected_substr in str(e), f"Error was {str(e)}, expected substring {expected_substr}"
assert error_raised

# TODO: Test case that supports storing FMU states required

@pytest.mark.skipif(True, reason = "Error controlled simulation only supported if storing FMU states are available.")
def test_error_controlled_with_downsampling(self):
models, connections = self._load_basic_simulation()
uptate_options = {'result_downsampling_factor': 2,
'error_controlled': True}
# TODO: Tidy up with pytest
msg = "Result downsampling not supported for error controlled simulation, no downsampling will be performed."
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("default")
with pytest.warns(UserWarning, match = msg):
self._sim_basic_simulation(models, connections, uptate_options)
# there will be some other warnings from FMU loading
assert f"UserWarning('{msg}')" in [i.message for i in w]

def test_downsample_result_with_store_step_before_update(self):
""" Test result_downsampling_factor with store_step_before_update. """
Expand Down

0 comments on commit eda3a4b

Please sign in to comment.