We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bec8b7d commit 0961c94Copy full SHA for 0961c94
1 file changed
src/embed_tests/TestPythonException.cs
@@ -55,6 +55,36 @@ public void TestPythonErrorTypeName()
55
}
56
57
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
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
88
[Test]
89
public void TestPythonExceptionFormat()
90
{
0 commit comments