File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -350,12 +350,30 @@ def test_iteration_exception():
350350 from Python .Test import ExceptionTest
351351 from System import OverflowException
352352
353- val = ExceptionTest .ThrowExceptionInIterator ().__iter__ ()
353+ exception = OverflowException ("error" )
354+
355+ val = ExceptionTest .ThrowExceptionInIterator (exception ).__iter__ ()
356+ assert next (val ) == 1
357+ assert next (val ) == 2
358+ with pytest .raises (OverflowException ) as cm :
359+ next (val )
360+
361+ exc = cm .value
362+
363+ assert exc == exception
364+
365+ def test_iteration_innerexception ():
366+ from Python .Test import ExceptionTest
367+ from System import OverflowException
368+
369+ exception = System .Exception ("message" , OverflowException ("error" ))
370+
371+ val = ExceptionTest .ThrowExceptionInIterator (exception ).__iter__ ()
354372 assert next (val ) == 1
355373 assert next (val ) == 2
356374 with pytest .raises (OverflowException ) as cm :
357375 next (val )
358376
359- exc = cm .value
377+ exc = cm .value
360378
361- assert isinstance ( exc , OverflowException )
379+ assert exc == exception . InnerException
You can’t perform that action at this time.
0 commit comments