forked from OpenModelica/OMPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_ModelicaSystemCmd.py
More file actions
33 lines (28 loc) · 858 Bytes
/
test_ModelicaSystemCmd.py
File metadata and controls
33 lines (28 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import OMPython
import pytest
@pytest.fixture
def model_firstorder(tmp_path):
mod = tmp_path / "M.mo"
mod.write_text("""model M
Real x(start = 1, fixed = true);
parameter Real a = -1;
equation
der(x) = x*a;
end M;
""")
return mod
def test_simflags(model_firstorder):
mod = OMPython.ModelicaSystem(fileName=model_firstorder.as_posix(), modelName="M")
mscmd = OMPython.ModelicaSystemCmd(runpath=mod.tempdir, modelname=mod.modelName)
mscmd.args_set({
"noEventEmit": None,
"noRestart": None,
"override": {'b': 2}
})
with pytest.deprecated_call():
mscmd.args_set(args=mscmd.parse_simflags(simflags="-noEventEmit -noRestart -override=a=1,x=3"))
assert mscmd.get_cmd() == [
mscmd.get_exe().as_posix(),
'-noEventEmit', '-noRestart',
'-override=b=2,a=1,x=3'
]