Closes #13258: Use callable() built-in in the standard library.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user