]> granicus.if.org Git - python/commitdiff
Change error report when the object passed to suite.addTest is not
authorR. David Murray <rdmurray@bitdance.com>
Thu, 28 Jan 2010 21:16:33 +0000 (21:16 +0000)
committerR. David Murray <rdmurray@bitdance.com>
Thu, 28 Jan 2010 21:16:33 +0000 (21:16 +0000)
callable to include the repr of the invalid object.

Lib/unittest/suite.py

index 730b4d9747abc11214515a0ea289736469ff4909..60e9b6c61dad035f6d6d33d8c9cf32eae409b16e 100644 (file)
@@ -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 "