Skip to content

Commit 007cac7

Browse files
Add tests
1 parent 2f0e336 commit 007cac7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Lib/test/test_exception_group.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,18 @@ class MyEG(ExceptionGroup):
234234
"ExceptionGroup('test', deque([ValueError(1), TypeError(2)]))"
235235
)
236236

237+
def test_repr_small_size_args(self):
238+
eg = ExceptionGroup("msg", [ValueError()])
239+
eg.args = ()
240+
# repr of the ExceptionGroup with empty args should not crash
241+
self.assertEqual(repr(eg), "ExceptionGroup('msg', (ValueError(),))")
242+
243+
eg.args = (1,)
244+
# repr of the ExceptionGroup with 1-size args should not crash
245+
self.assertEqual(repr(eg), "ExceptionGroup('msg', (ValueError(),))")
246+
247+
248+
237249
def test_repr_raises(self):
238250
class MySeq(collections.abc.Sequence):
239251
def __init__(self, raises):

0 commit comments

Comments
 (0)