File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -187,18 +187,14 @@ def test_class_cause(self):
187187
188188 @unittest .expectedFailure # TODO: RUSTPYTHON; TypeError: 'classmethod' object is not callable
189189 def test_class_cause_nonexception_result (self ):
190- class ConstructsNone ( BaseException ):
191- @ classmethod
190+ # See https://github.com/python/cpython/issues/140530.
191+ class ConstructMortal ( BaseException ):
192192 def __new__ (* args , ** kwargs ):
193- return None
194- try :
195- raise IndexError from ConstructsNone
196- except TypeError as e :
197- self .assertIn ("should have returned an instance of BaseException" , str (e ))
198- except IndexError :
199- self .fail ("Wrong kind of exception raised" )
200- else :
201- self .fail ("No exception raised" )
193+ return ["mortal value" ]
194+
195+ msg = ".*should have returned an instance of BaseException.*"
196+ with self .assertRaisesRegex (TypeError , msg ):
197+ raise IndexError from ConstructMortal
202198
203199 def test_instance_cause (self ):
204200 cause = KeyError ()
You can’t perform that action at this time.
0 commit comments