Author: guido.van.rossum
Date: Tue Jul 10 11:10:40 2007
New Revision: 56231

Modified:
   python/branches/py3k-struni/Lib/unittest.py
Log:
Add the function/method name to assertRaises.


Modified: python/branches/py3k-struni/Lib/unittest.py
==============================================================================
--- python/branches/py3k-struni/Lib/unittest.py (original)
+++ python/branches/py3k-struni/Lib/unittest.py Tue Jul 10 11:10:40 2007
@@ -311,9 +311,10 @@
         except excClass:
             return
         else:
-            if hasattr(excClass,'__name__'): excName = excClass.__name__
-            else: excName = str(excClass)
-            raise self.failureException, "%s not raised" % excName
+            excName = str(getattr(excClass, '__name__', excClass))
+            objName = str(getattr(callableObj, '__name__', callableObj))
+            raise self.failureException, "%s not raised by %s" % (excName,
+                                                                  objName)
 
     def failUnlessEqual(self, first, second, msg=None):
         """Fail if the two objects are unequal as determined by the '=='
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to