Closes #13258: Use callable() built-in in the standard library.

This commit is contained in:
Florent Xicluna
2011-10-28 14:45:05 +02:00
parent f99e4b5dbe
commit 5d1155c08e
25 changed files with 48 additions and 51 deletions

View File

@@ -113,7 +113,7 @@ class TestLoader(object):
return self.suiteClass([inst])
elif isinstance(obj, suite.TestSuite):
return obj
if hasattr(obj, '__call__'):
if callable(obj):
test = obj()
if isinstance(test, suite.TestSuite):
return test
@@ -138,7 +138,7 @@ class TestLoader(object):
def isTestMethod(attrname, testCaseClass=testCaseClass,
prefix=self.testMethodPrefix):
return attrname.startswith(prefix) and \
hasattr(getattr(testCaseClass, attrname), '__call__')
callable(getattr(testCaseClass, attrname))
testFnNames = testFnNames = list(filter(isTestMethod,
dir(testCaseClass)))
if self.sortTestMethodsUsing: