mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Merge 3.2
This commit is contained in:
commit
aabbda5354
27 changed files with 51 additions and 54 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class BaseTestSuite(object):
|
|||
|
||||
def addTest(self, test):
|
||||
# sanity checks
|
||||
if not hasattr(test, '__call__'):
|
||||
if not callable(test):
|
||||
raise TypeError("{} is not callable".format(repr(test)))
|
||||
if isinstance(test, type) and issubclass(test,
|
||||
(case.TestCase, TestSuite)):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue