File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed
Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ class Model(abc.ABC):
1616 def __init__ (self ):
1717 ...
1818
19+ def __repr__ (self ):
20+ return f"<{ self .__class__ .__name__ } { self .model_id !r} >"
21+
1922 @staticmethod
2023 @abc .abstractmethod
2124 def from_file (filepath_or_buffer : Any , model_id : str ) -> Model :
Original file line number Diff line number Diff line change @@ -87,3 +87,9 @@ def test_pattern_parsing(uses_pysb):
8787 pattern = pysb .as_complex_pattern (B (s = "a" ) ** c1 )
8888 assert pattern_from_string (str (pattern ), model ).matches (pattern )
8989 assert str (pattern ) == str (pattern_from_string ("B(s='a') ** c1" , model ))
90+
91+
92+ def test_pysb_model_repr (uses_pysb ):
93+ model = pysb .Model (name = "test" )
94+ petab_model = PySBModel (model )
95+ assert repr (petab_model ) == "<PySBModel 'test'>"
Original file line number Diff line number Diff line change 11import os
22import sys
33
4+ import libsbml
45import pandas as pd
56import pytest
67
8+ from petab .v1 .models .sbml_model import SbmlModel
9+
710sys .path .append (os .getcwd ())
811import petab # noqa: E402
912
@@ -122,3 +125,10 @@ def test_get_condition_specific_models():
122125 )
123126
124127 check_model (condition_model )
128+
129+
130+ def test_sbml_model_repr ():
131+ sbml_model = libsbml .SBMLDocument ().createModel ()
132+ sbml_model .setId ("test" )
133+ petab_model = SbmlModel (sbml_model )
134+ assert repr (petab_model ) == "<SbmlModel 'test'>"
You can’t perform that action at this time.
0 commit comments