88from sympy .abc import _clash
99from sympy .logic .boolalg import Boolean , BooleanFalse , BooleanTrue
1010
11- from petab .math import petab_math_str , sympify_petab
11+ from petab .v1 . math import petab_math_str , sympify_petab
1212
1313
1414def test_sympify_numpy ():
@@ -24,6 +24,15 @@ def test_parse_simple():
2424 assert float (sympify_petab ("1 + 2 * (3 + 4) / 2" )) == 8
2525
2626
27+ def test_assumptions ():
28+ # in PEtab, all symbols are expected to be real-valued
29+ assert sympify_petab ("x" ).is_real
30+
31+ # non-real symbols are changed to real
32+ # TODO: should we raise an error instead?
33+ assert sympify_petab (sp .Symbol ("x" , real = False )).is_real
34+
35+
2736def test_printer ():
2837 assert petab_math_str (BooleanTrue ()) == "true"
2938 assert petab_math_str (BooleanFalse ()) == "false"
@@ -87,9 +96,8 @@ def test_ids():
8796 assert sympify_petab ("bla * 2" ) == 2.0 * sp .Symbol ("bla" , real = True )
8897
8998 # test that sympy expressions that are invalid in PEtab raise an error
90- # TODO: handle these cases after
91- # https://github.com/PEtab-dev/libpetab-python/pull/364
92- # sympify_petab(sp.Symbol("föö"))
99+ with pytest .raises (ValueError ):
100+ sympify_petab (sp .Symbol ("föö" ))
93101
94102
95103def test_syntax_error ():
0 commit comments