Change error report when the object passed to suite.addTest is not
callable to include the repr of the invalid object.
This commit is contained in:
parent
11fab6c07d
commit
b5d7400e8a
|
@ -43,7 +43,7 @@ class TestSuite(object):
|
||||||
def addTest(self, test):
|
def addTest(self, test):
|
||||||
# sanity checks
|
# sanity checks
|
||||||
if not hasattr(test, '__call__'):
|
if not hasattr(test, '__call__'):
|
||||||
raise TypeError("the test to add must be callable")
|
raise TypeError("{} is not callable".format(repr(test)))
|
||||||
if isinstance(test, type) and issubclass(test,
|
if isinstance(test, type) and issubclass(test,
|
||||||
(case.TestCase, TestSuite)):
|
(case.TestCase, TestSuite)):
|
||||||
raise TypeError("TestCases and TestSuites must be instantiated "
|
raise TypeError("TestCases and TestSuites must be instantiated "
|
||||||
|
|
Loading…
Reference in New Issue