diff --git a/tests/test_structs.py b/tests/test_structs.py index f1b9625e..058fcdf2 100644 --- a/tests/test_structs.py +++ b/tests/test_structs.py @@ -1,3 +1,4 @@ +from bionetgen.modelapi.structs import Action import pytest from bionetgen.modelapi.structs import ModelObj @@ -43,6 +44,24 @@ def test_modelobj_line_label_setter(): assert obj.line_label == "[1, 2, 3]: " +def test_action_print_line(): + action = Action(action_type="simulate", action_args={"method": "ode", "t_end": 10}) + # Basic print_line without comment or label + assert action.print_line() == "simulate({method=>ode,t_end=>10})" + + # Print with line label + action.line_label = 1 + assert action.print_line() == "1 simulate({method=>ode,t_end=>10})" + + # Print with comment + action.comment = "test comment" + assert action.print_line() == "1 simulate({method=>ode,t_end=>10}) #test comment" + + # Print with comment but no label + action._line_label = None + assert action.print_line() == "simulate({method=>ode,t_end=>10}) #test comment" + + def test_action_gen_string(): from bionetgen.modelapi.structs import Action