@@ -65,14 +65,12 @@ class subtype(self.__class__.type2test):
6565 self .assertTrue (object is not realresult )
6666
6767 # check that object.method(*args) raises exc
68- def checkraises (self , exc , object , methodname , * args ):
69- object = self .fixtype (object )
68+ def checkraises (self , exc , obj , methodname , * args ):
69+ obj = self .fixtype (obj )
7070 args = self .fixtype (args )
71- self .assertRaises (
72- exc ,
73- getattr (object , methodname ),
74- * args
75- )
71+ with self .assertRaises (exc ) as cm :
72+ getattr (obj , methodname )(* args )
73+ self .assertNotEqual (cm .exception .message , '' )
7674
7775 # call object.method(*args) without any checks
7876 def checkcall (self , object , methodname , * args ):
@@ -1057,6 +1055,7 @@ def test_join(self):
10571055 self .checkequal ('a b c' , ' ' , 'join' , BadSeq2 ())
10581056
10591057 self .checkraises (TypeError , ' ' , 'join' )
1058+ self .checkraises (TypeError , ' ' , 'join' , None )
10601059 self .checkraises (TypeError , ' ' , 'join' , 7 )
10611060 self .checkraises (TypeError , ' ' , 'join' , Sequence ([7 , 'hello' , 123L ]))
10621061 try :
0 commit comments