File tree 1 file changed +21
-3
lines changed 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():
350
350
from Python .Test import ExceptionTest
351
351
from System import OverflowException
352
352
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__ ()
354
372
assert next (val ) == 1
355
373
assert next (val ) == 2
356
374
with pytest .raises (OverflowException ) as cm :
357
375
next (val )
358
376
359
- exc = cm .value
377
+ exc = cm .value
360
378
361
- assert isinstance ( exc , OverflowException )
379
+ assert exc == exception . InnerException
You can’t perform that action at this time.
0 commit comments