From: R. David Murray Date: Thu, 28 Jan 2010 21:16:33 +0000 (+0000) Subject: Change error report when the object passed to suite.addTest is not X-Git-Tag: v2.7a3~67 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b5d7400e8a62ebedb8575cca8cd777e29c230e91;p=thirdparty%2FPython%2Fcpython.git Change error report when the object passed to suite.addTest is not callable to include the repr of the invalid object. --- diff --git a/Lib/unittest/suite.py b/Lib/unittest/suite.py index 730b4d9747ab..60e9b6c61dad 100644 --- a/Lib/unittest/suite.py +++ b/Lib/unittest/suite.py @@ -43,7 +43,7 @@ class TestSuite(object): def addTest(self, test): # sanity checks 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, (case.TestCase, TestSuite)): raise TypeError("TestCases and TestSuites must be instantiated "