Skip to content

Commit 820c90d

Browse files
aiskclaude
andcommitted
Test the no memory case
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
1 parent fc49e09 commit 820c90d

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

‎Lib/test/test_interpreters/test_api.py‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -949,13 +949,18 @@ def test_failure(self):
949949

950950
def test_failure_with_broken_exception_str(self):
951951
interp = interpreters.create()
952-
with self.assertRaises(interpreters.InterpreterError):
953-
interp.exec(dedent("""
954-
class BrokenError(Exception):
955-
def __str__(self):
956-
raise ValueError
957-
raise BrokenError
958-
"""))
952+
for raised, expected in [
953+
('ValueError', interpreters.InterpreterError),
954+
('MemoryError', MemoryError),
955+
]:
956+
with self.subTest(raised=raised):
957+
with self.assertRaises(expected):
958+
interp.exec(dedent(f"""
959+
class BrokenError(Exception):
960+
def __str__(self):
961+
raise {raised}
962+
raise BrokenError
963+
"""))
959964

960965
@force_not_colorized
961966
def test_display_preserved_exception(self):

0 commit comments

Comments
 (0)