Add the function/method name to assertRaises.

This commit is contained in:
Guido van Rossum 2007-07-10 09:10:40 +00:00
parent a098294446
commit 2b6a97e69c
1 changed files with 4 additions and 3 deletions

View File

@ -311,9 +311,10 @@ class TestCase:
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 '=='