Skip to content

Commit 72918ea

Browse files
committed
Update ExceptionGroup tests to no longer change the repr
1 parent af4f086 commit 72918ea

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Lib/test/test_exception_group.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def test_ExceptionGroup(self):
137137

138138
self.assertEqual(str(eg), "flat (2 sub-exceptions)")
139139
self.assertEqual(repr(eg),
140-
"ExceptionGroup('flat', (ValueError(1), TypeError(2)))")
140+
"ExceptionGroup('flat', [ValueError(1), TypeError(2)])")
141141

142142
# Mutate the list of exceptions passed to BaseExceptionGroup.
143143
# This shouldn't change the EG's functionality, nor its repr.
@@ -149,11 +149,11 @@ def test_ExceptionGroup(self):
149149
self.assertEqual(str(eg), "nested (4 sub-exceptions)")
150150
self.assertEqual(repr(eg),
151151
"ExceptionGroup('nested', "
152-
"(ExceptionGroup('flat', "
153-
"(ValueError(1), TypeError(2))), "
152+
"[ExceptionGroup('flat', "
153+
"[ValueError(1), TypeError(2)]), "
154154
"ValueError(1), "
155155
"ExceptionGroup('flat', "
156-
"(ValueError(1), TypeError(2))), TypeError(2)))")
156+
"[ValueError(1), TypeError(2)]), TypeError(2)])")
157157

158158
def test_BaseExceptionGroup(self):
159159
eg_excs = [ValueError(1), KeyboardInterrupt(2)]
@@ -164,7 +164,7 @@ def test_BaseExceptionGroup(self):
164164
self.assertEqual(repr(eg),
165165
"BaseExceptionGroup("
166166
"'flat', "
167-
"(ValueError(1), KeyboardInterrupt(2)))")
167+
"[ValueError(1), KeyboardInterrupt(2)])")
168168

169169
# Mutate the list of exceptions passed to BaseExceptionGroup.
170170
# This shouldn't change the EG's functionality, nor its repr.
@@ -176,11 +176,11 @@ def test_BaseExceptionGroup(self):
176176
self.assertEqual(str(eg), "nested (3 sub-exceptions)")
177177
self.assertEqual(repr(eg),
178178
"BaseExceptionGroup('nested', "
179-
"(BaseExceptionGroup('flat', "
180-
"(ValueError(1), KeyboardInterrupt(2))), "
179+
"[BaseExceptionGroup('flat', "
180+
"[ValueError(1), KeyboardInterrupt(2)]), "
181181
"ValueError(1), "
182182
"BaseExceptionGroup('flat', "
183-
"(ValueError(1), KeyboardInterrupt(2)))))")
183+
"[ValueError(1), KeyboardInterrupt(2)])])")
184184

185185
def test_custom_exception(self):
186186
class MyEG(ExceptionGroup):
@@ -191,7 +191,7 @@ class MyEG(ExceptionGroup):
191191
'flat', eg_excs)
192192

193193
self.assertEqual(str(eg), "flat (2 sub-exceptions)")
194-
self.assertEqual(repr(eg), "MyEG('flat', (ValueError(1), TypeError(2)))")
194+
self.assertEqual(repr(eg), "MyEG('flat', [ValueError(1), TypeError(2)])")
195195

196196
# Mutate the list of exceptions passed to MyEG.
197197
# This shouldn't change the EG's functionality, nor its repr.
@@ -203,10 +203,10 @@ class MyEG(ExceptionGroup):
203203
self.assertEqual(str(eg), "nested (4 sub-exceptions)")
204204
self.assertEqual(repr(eg), (
205205
"MyEG('nested', "
206-
"(MyEG('flat', (ValueError(1), TypeError(2))), "
206+
"[MyEG('flat', [ValueError(1), TypeError(2)]), "
207207
"ValueError(1), "
208-
"MyEG('flat', (ValueError(1), TypeError(2))), "
209-
"TypeError(2)))"))
208+
"MyEG('flat', [ValueError(1), TypeError(2)]), "
209+
"TypeError(2)])"))
210210

211211

212212
def create_simple_eg():

0 commit comments

Comments
 (0)