@@ -985,16 +985,11 @@ def test_str(self):
985985 cf = self .config_class (allow_no_value = True , delimiters = ('=' ,), strict = True )
986986 cf .add_section ("sect1" )
987987 cf .add_section ("sect2" )
988- cf .add_section ("sect3" )
989- cf .add_section ("sect4" )
990- cf .add_section ("sect5" )
991- cf .add_section ("sect6" )
992988 cf .set ("sect1" , "option1" , "foo" )
993989 cf .set ("sect2" , "option2" , "bar" )
994990
995991 expected_str = (
996- "<ConfigParser: {'sect1': {'option1': 'foo'}, 'sect2': {'option2': 'bar'}, "
997- "'sect3': {}, 'sect4': {}, 'sect5': {}, 'sect6': {}}>"
992+ "<ConfigParser: {'sect1': {'option1': 'foo'}, 'sect2': {'option2': 'bar'}}>"
998993 )
999994 self .assertEqual (str (cf ), expected_str )
1000995
@@ -1012,17 +1007,23 @@ def test_repr(self):
10121007 cf .read_string ("" )
10131008
10141009 dict_type = type (cf ._dict ).__name__
1015-
1016- expected_repr = (
1017- f"<{ cf .__class__ .__name__ } ("
1018- f"params={{'dict_type': '{ dict_type } ', 'allow_no_value': True, "
1019- "'delimiters': ('=',), 'strict': True, 'default_section': 'DEFAULT', "
1020- "'interpolation': 'BasicInterpolation'}, "
1021- "state={'loaded_sources': ['<string>'], 'sections_count': 6, "
1022- "'sections': ['sect1', 'sect2', 'sect3', 'sect4', 'sect5'], "
1023- "'sections_truncated': '...and 1 more'})>"
1024- )
1025- self .assertEqual (repr (cf ), expected_repr )
1010+ classname = cf .__class__ .__name__
1011+ params = {
1012+ 'dict_type' : dict_type ,
1013+ 'allow_no_value' : True ,
1014+ 'delimiters' : ('=' ,),
1015+ 'strict' : True ,
1016+ 'default_section' : 'DEFAULT' ,
1017+ 'interpolation' : 'BasicInterpolation' ,
1018+ }
1019+ state = {
1020+ 'loaded_sources' : ['<string>' ],
1021+ 'sections_count' : 6 ,
1022+ 'sections' : ['sect1' , 'sect2' , 'sect3' , 'sect4' , 'sect5' ],
1023+ 'sections_truncated' : '...and 1 more' ,
1024+ }
1025+ expected = f"<{ classname } ({ params = } , { state = } )>"
1026+ self .assertEqual (repr (cf ), expected )
10261027
10271028 def test_add_section_default (self ):
10281029 cf = self .newconfig ()
0 commit comments