diff options
author | Christian Heimes <christian@cheimes.de> | 2007-11-25 09:39:14 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2007-11-25 09:39:14 (GMT) |
commit | 4a22b5dee77b6a3439e4a09362586c390bbdef02 (patch) | |
tree | 670472c02e788fe4d027f7967fbbd8253e18cb5f /Lib/test/test_pyclbr.py | |
parent | 91c77301bf0246deabcdcd80bc7bedb169e2f964 (diff) | |
download | cpython-4a22b5dee77b6a3439e4a09362586c390bbdef02.zip cpython-4a22b5dee77b6a3439e4a09362586c390bbdef02.tar.gz cpython-4a22b5dee77b6a3439e4a09362586c390bbdef02.tar.bz2 |
Patch from Georg Brandl and me for #1493
Remove unbound method objects
Diffstat (limited to 'Lib/test/test_pyclbr.py')
-rw-r--r-- | Lib/test/test_pyclbr.py | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py index caccf11..bcb7988 100644 --- a/Lib/test/test_pyclbr.py +++ b/Lib/test/test_pyclbr.py @@ -64,23 +64,17 @@ class PyclbrTest(TestCase): def ismethod(oclass, obj, name): classdict = oclass.__dict__ - if isinstance(obj, FunctionType): - if not isinstance(classdict[name], StaticMethodType): + if isinstance(obj, MethodType): + # could be a classmethod + if (not isinstance(classdict[name], ClassMethodType) or + obj.im_self is not oclass): return False - else: - if not isinstance(obj, MethodType): - return False - if obj.im_self is not None: - if (not isinstance(classdict[name], ClassMethodType) or - obj.im_self is not oclass): - return False - else: - if not isinstance(classdict[name], FunctionType): - return False + elif not isinstance(obj, FunctionType): + return False objname = obj.__name__ if objname.startswith("__") and not objname.endswith("__"): - objname = "_%s%s" % (obj.im_class.__name__, objname) + objname = "_%s%s" % (oclass.__name__, objname) return objname == name # Make sure the toplevel functions and classes are the same. @@ -154,7 +148,7 @@ class PyclbrTest(TestCase): # XXX: See comment in pyclbr_input.py for a test that would fail # if it were not commented out. # - self.checkModule('test.pyclbr_input') + self.checkModule('test.pyclbr_input', ignore=['om']) def test_others(self): cm = self.checkModule |