File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,36 @@ public void TestPythonErrorTypeName()
5555 }
5656 }
5757
58+ [ Test ]
59+ public void TestNestedExceptions ( )
60+ {
61+ try
62+ {
63+ PythonEngine . Exec ( @"
64+ try:
65+ raise Exception('inner')
66+ except Exception as ex:
67+ raise Exception('outer') from ex
68+ " ) ;
69+ }
70+ catch ( PythonException ex )
71+ {
72+ Assert . That ( ex . InnerException , Is . InstanceOf < PythonException > ( ) ) ;
73+ Assert . That ( ex . InnerException . Message , Is . EqualTo ( "Exception : inner" ) ) ;
74+ }
75+ }
76+
77+ [ Test ]
78+ public void InnerIsEmptyWithNoCause ( )
79+ {
80+ var list = new PyList ( ) ;
81+ PyObject foo = null ;
82+
83+ var ex = Assert . Throws < PythonException > ( ( ) => foo = list [ 0 ] ) ;
84+
85+ Assert . IsNull ( ex . InnerException ) ;
86+ }
87+
5888 [ Test ]
5989 public void TestPythonExceptionFormat ( )
6090 {
You can’t perform that action at this time.
0 commit comments