diff --git a/tests/test_structs.py b/tests/test_structs.py index c6addd6d..e2ee35a0 100644 --- a/tests/test_structs.py +++ b/tests/test_structs.py @@ -1,6 +1,6 @@ from bionetgen.modelapi.structs import Action import pytest -from bionetgen.modelapi.structs import ModelObj +from bionetgen.modelapi.structs import ModelObj, Action def test_modelobj_setitem(): @@ -44,6 +44,31 @@ def test_modelobj_line_label_setter(): assert obj.line_label == "[1, 2, 3]: " +def test_action_print_line_v2(): + action = Action("simulate", {"method": "ode", "t_end": 100, "n_steps": 100}) + # Test base print_line + assert action.print_line() == "simulate({method=>ode,t_end=>100,n_steps=>100})" + + # Test with line_label + action.line_label = 1 + assert action.print_line() == "1 simulate({method=>ode,t_end=>100,n_steps=>100})" + + # Test with comment + action = Action("simulate", {"method": "ode", "t_end": 100, "n_steps": 100}) + action.comment = "This is a comment" + assert ( + action.print_line() + == "simulate({method=>ode,t_end=>100,n_steps=>100}) #This is a comment" + ) + + # Test with line_label and comment + action.line_label = 1 + assert ( + action.print_line() + == "1 simulate({method=>ode,t_end=>100,n_steps=>100}) #This is a comment" + ) + + def test_modelobj_print_line(): class DummyModelObj(ModelObj): def gen_string(self) -> str: