@@ -78,7 +78,8 @@ def ismethod(oclass, obj, name):
7878
7979 objname = obj .__name__
8080 if objname .startswith ("__" ) and not objname .endswith ("__" ):
81- objname = "_%s%s" % (oclass .__name__ , objname )
81+ if stripped_typename := oclass .__name__ .lstrip ('_' ):
82+ objname = f"_{ stripped_typename } { objname } "
8283 return objname == name
8384
8485 # Make sure the toplevel functions and classes are the same.
@@ -111,12 +112,16 @@ def ismethod(oclass, obj, name):
111112 for m in py_item .__dict__ .keys ():
112113 if ismethod (py_item , getattr (py_item , m ), m ):
113114 actualMethods .append (m )
114- foundMethods = []
115- for m in value .methods .keys ():
116- if m [:2 ] == '__' and m [- 2 :] != '__' :
117- foundMethods .append ('_' + name + m )
118- else :
119- foundMethods .append (m )
115+
116+ if stripped_typename := name .lstrip ('_' ):
117+ foundMethods = []
118+ for m in value .methods .keys ():
119+ if m .startswith ('__' ) and not m .endswith ('__' ):
120+ foundMethods .append (f"_{ stripped_typename } { m } " )
121+ else :
122+ foundMethods .append (m )
123+ else :
124+ foundMethods = list (value .methods .keys ())
120125
121126 try :
122127 self .assertListEq (foundMethods , actualMethods , ignore )
@@ -150,8 +155,9 @@ def test_easy(self):
150155 "DocTestCase" , '_DocTestSuite' ))
151156 self .checkModule ('difflib' , ignore = ("Match" ,))
152157
153- def test_decorators (self ):
154- self .checkModule ('test.pyclbr_input' , ignore = ['om' ])
158+ def test_cases (self ):
159+ # see test.pyclbr_input for the rationale behind the ignored symbols
160+ self .checkModule ('test.pyclbr_input' , ignore = ['om' , 'f' ])
155161
156162 def test_nested (self ):
157163 mb = pyclbr
0 commit comments