File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44"""
55from test import test_support
66import unittest
7+ from javatests import StackOverflowErrorTest
8+
79
810class C :
911 def __str__ (self ):
@@ -41,6 +43,19 @@ def testBugFix1149372(self):
4143 return
4244 unittest .fail ("if __str__ raises an exception, re-raise" )
4345
46+ def test_wrap_StackOverflowError (self ):
47+ with self .assertRaises (RuntimeError ) as cm :
48+ StackOverflowErrorTest .throwStackOverflowError ()
49+ self .assertEqual (
50+ cm .exception .message ,
51+ "maximum recursion depth exceeded (Java StackOverflowError)" )
52+
53+ with self .assertRaises (RuntimeError ) as cm :
54+ StackOverflowErrorTest .causeStackOverflowError ()
55+ self .assertEqual (
56+ cm .exception .message ,
57+ "maximum recursion depth exceeded (Java StackOverflowError)" )
58+
4459
4560def test_main ():
4661 test_support .run_unittest (ExceptionsTestCase )
Original file line number Diff line number Diff line change 1+ package javatests ;
2+
3+ public class StackOverflowErrorTest {
4+
5+ public static void throwStackOverflowError () {
6+ throw new StackOverflowError ();
7+ }
8+
9+ public static void causeStackOverflowError () {
10+ causeStackOverflowError ();
11+ }
12+ }
You can’t perform that action at this time.
0 commit comments