mirror of
https://github.com/python/cpython.git
synced 2025-10-08 08:01:55 +00:00
check that exception messages are not empty (#22379)
Patch by Yongzhi Pan.
This commit is contained in:
parent
623ae29469
commit
c31f12d196
4 changed files with 13 additions and 15 deletions
|
@ -28,14 +28,12 @@ class UserStringTest(
|
|||
realresult
|
||||
)
|
||||
|
||||
def checkraises(self, exc, object, methodname, *args):
|
||||
object = self.fixtype(object)
|
||||
def checkraises(self, exc, obj, methodname, *args):
|
||||
obj = self.fixtype(obj)
|
||||
# we don't fix the arguments, because UserString can't cope with it
|
||||
self.assertRaises(
|
||||
exc,
|
||||
getattr(object, methodname),
|
||||
*args
|
||||
)
|
||||
with self.assertRaises(exc) as cm:
|
||||
getattr(obj, methodname)(*args)
|
||||
self.assertNotEqual(str(cm.exception), '')
|
||||
|
||||
def checkcall(self, object, methodname, *args):
|
||||
object = self.fixtype(object)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue