def testMethod(self): #{{{ '''Only pure method returns True''' class Test(object): #{{{ def test(self): pass @classmethod def class_(cls): pass @staticmethod def static(): pass # End class #}}} for m in ('test', 'class_'): self.assertTrue(ismethod(getattr(Test, m))) self.assertFalse(ismethod(Test.static))
def testCallable(self): #{{{ '''Arbitrary non-function callable returns False''' class Test(object): #{{{ def __call__(self): #{{{ pass # End def #}}} # End class #}}} for c in (Test, Test()): self.assertFalse(ismethod(c))
def testPythonObject(self): #{{{ '''Arbitrary object returns False''' self.assertFalse(ismethod(1))
def testBuiltinFunction(self): #{{{ '''Built-in function returns false''' self.assertFalse(ismethod(max))
def testPythonFunction(self): #{{{ '''Pure python function returns False''' self.assertFalse(ismethod(ismethod))