[Python-checkins] r77815 - python/trunk/Lib/unittest/suite.py

r.david.murray python-checkins at python.org
Thu Jan 28 22:16:33 CET 2010


Author: r.david.murray
Date: Thu Jan 28 22:16:33 2010
New Revision: 77815

Log:
Change error report when the object passed to suite.addTest is not
callable to include the repr of the invalid object.


Modified:
   python/trunk/Lib/unittest/suite.py

Modified: python/trunk/Lib/unittest/suite.py
==============================================================================
--- python/trunk/Lib/unittest/suite.py	(original)
+++ python/trunk/Lib/unittest/suite.py	Thu Jan 28 22:16:33 2010
@@ -43,7 +43,7 @@
     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 "


More information about the Python-checkins mailing list