Skip to content

Commit 13c969d

Browse files
committed
fix test_pyclbr for double-underscore methods
1 parent caa7bab commit 13c969d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Lib/test/test_pyclbr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ 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+
objname = "_%s%s" % (oclass.__name__.lstrip('_'), objname)
8282
return objname == name
8383

8484
# Make sure the toplevel functions and classes are the same.
@@ -115,8 +115,8 @@ def ismethod(oclass, obj, name):
115115
actualMethods.append(m)
116116
foundMethods = []
117117
for m in value.methods.keys():
118-
if m[:2] == '__' and m[-2:] != '__':
119-
foundMethods.append('_'+name+m)
118+
if m.startswith('__') and not m.endswith('__'):
119+
foundMethods.append(f"_{name.lstrip('_')}{m}")
120120
else:
121121
foundMethods.append(m)
122122

0 commit comments

Comments
 (0)