@@ -1403,7 +1403,7 @@ def exc():
1403
1403
f' | File "{ __file__ } ", line { exc .__code__ .co_firstlineno + 1 } , in exc\n '
1404
1404
f' | raise ExceptionGroup("eg", [ValueError(1), TypeError(2)])\n '
1405
1405
f' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n '
1406
- f' | ExceptionGroup: eg\n '
1406
+ f' | ExceptionGroup: eg (2 sub-exceptions) \n '
1407
1407
f' +-+---------------- 1 ----------------\n '
1408
1408
f' | ValueError: 1\n '
1409
1409
f' +---------------- 2 ----------------\n '
@@ -1425,7 +1425,7 @@ def exc():
1425
1425
f' | File "{ __file__ } ", line { exc .__code__ .co_firstlineno + 3 } , in exc\n '
1426
1426
f' | raise EG("eg1", [ValueError(1), TypeError(2)])\n '
1427
1427
f' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n '
1428
- f' | ExceptionGroup: eg1\n '
1428
+ f' | ExceptionGroup: eg1 (2 sub-exceptions) \n '
1429
1429
f' +-+---------------- 1 ----------------\n '
1430
1430
f' | ValueError: 1\n '
1431
1431
f' +---------------- 2 ----------------\n '
@@ -1441,7 +1441,7 @@ def exc():
1441
1441
f' | File "{ __file__ } ", line { exc .__code__ .co_firstlineno + 5 } , in exc\n '
1442
1442
f' | raise EG("eg2", [ValueError(3), TypeError(4)]) from e\n '
1443
1443
f' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n '
1444
- f' | ExceptionGroup: eg2\n '
1444
+ f' | ExceptionGroup: eg2 (2 sub-exceptions) \n '
1445
1445
f' +-+---------------- 1 ----------------\n '
1446
1446
f' | ValueError: 3\n '
1447
1447
f' +---------------- 2 ----------------\n '
@@ -1467,7 +1467,7 @@ def exc():
1467
1467
f' | File "{ __file__ } ", line { exc .__code__ .co_firstlineno + 4 } , in exc\n '
1468
1468
f' | raise EG("eg1", [ValueError(1), TypeError(2)])\n '
1469
1469
f' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n '
1470
- f' | ExceptionGroup: eg1\n '
1470
+ f' | ExceptionGroup: eg1 (2 sub-exceptions) \n '
1471
1471
f' +-+---------------- 1 ----------------\n '
1472
1472
f' | ValueError: 1\n '
1473
1473
f' +---------------- 2 ----------------\n '
@@ -1480,7 +1480,7 @@ def exc():
1480
1480
f' | File "{ __file__ } ", line { exc .__code__ .co_firstlineno + 6 } , in exc\n '
1481
1481
f' | raise EG("eg2", [ValueError(3), TypeError(4)])\n '
1482
1482
f' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n '
1483
- f' | ExceptionGroup: eg2\n '
1483
+ f' | ExceptionGroup: eg2 (2 sub-exceptions) \n '
1484
1484
f' +-+---------------- 1 ----------------\n '
1485
1485
f' | ValueError: 3\n '
1486
1486
f' +---------------- 2 ----------------\n '
@@ -1519,15 +1519,15 @@ def exc():
1519
1519
f' | File "{ __file__ } ", line { exc .__code__ .co_firstlineno + 9 } , in exc\n '
1520
1520
f' | raise EG("eg", [VE(1), exc, VE(4)])\n '
1521
1521
f' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n '
1522
- f' | ExceptionGroup: eg\n '
1522
+ f' | ExceptionGroup: eg (3 sub-exceptions) \n '
1523
1523
f' +-+---------------- 1 ----------------\n '
1524
1524
f' | ValueError: 1\n '
1525
1525
f' +---------------- 2 ----------------\n '
1526
1526
f' | Exception Group Traceback (most recent call last):\n '
1527
1527
f' | File "{ __file__ } ", line { exc .__code__ .co_firstlineno + 6 } , in exc\n '
1528
1528
f' | raise EG("nested", [TE(2), TE(3)])\n '
1529
1529
f' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n '
1530
- f' | ExceptionGroup: nested\n '
1530
+ f' | ExceptionGroup: nested (2 sub-exceptions) \n '
1531
1531
f' +-+---------------- 1 ----------------\n '
1532
1532
f' | TypeError: 2\n '
1533
1533
f' +---------------- 2 ----------------\n '
@@ -1546,7 +1546,7 @@ def exc():
1546
1546
f' | File "{ __file__ } ", line { exc .__code__ .co_firstlineno + 11 } , in exc\n '
1547
1547
f' | raise EG("top", [VE(5)])\n '
1548
1548
f' | ^^^^^^^^^^^^^^^^^^^^^^^^\n '
1549
- f' | ExceptionGroup: top\n '
1549
+ f' | ExceptionGroup: top (1 sub-exception) \n '
1550
1550
f' +-+---------------- 1 ----------------\n '
1551
1551
f' | ValueError: 5\n '
1552
1552
f' +------------------------------------\n ' )
@@ -1560,7 +1560,7 @@ def test_exception_group_width_limit(self):
1560
1560
excs .append (ValueError (i ))
1561
1561
eg = ExceptionGroup ('eg' , excs )
1562
1562
1563
- expected = (' | ExceptionGroup: eg\n '
1563
+ expected = (' | ExceptionGroup: eg (1000 sub-exceptions) \n '
1564
1564
' +-+---------------- 1 ----------------\n '
1565
1565
' | ValueError: 0\n '
1566
1566
' +---------------- 2 ----------------\n '
@@ -1605,43 +1605,43 @@ def test_exception_group_depth_limit(self):
1605
1605
f'eg{ i } ' ,
1606
1606
[ValueError (i ), exc , ValueError (- i )])
1607
1607
1608
- expected = (' | ExceptionGroup: eg999\n '
1608
+ expected = (' | ExceptionGroup: eg999 (3 sub-exceptions) \n '
1609
1609
' +-+---------------- 1 ----------------\n '
1610
1610
' | ValueError: 999\n '
1611
1611
' +---------------- 2 ----------------\n '
1612
- ' | ExceptionGroup: eg998\n '
1612
+ ' | ExceptionGroup: eg998 (3 sub-exceptions) \n '
1613
1613
' +-+---------------- 1 ----------------\n '
1614
1614
' | ValueError: 998\n '
1615
1615
' +---------------- 2 ----------------\n '
1616
- ' | ExceptionGroup: eg997\n '
1616
+ ' | ExceptionGroup: eg997 (3 sub-exceptions) \n '
1617
1617
' +-+---------------- 1 ----------------\n '
1618
1618
' | ValueError: 997\n '
1619
1619
' +---------------- 2 ----------------\n '
1620
- ' | ExceptionGroup: eg996\n '
1620
+ ' | ExceptionGroup: eg996 (3 sub-exceptions) \n '
1621
1621
' +-+---------------- 1 ----------------\n '
1622
1622
' | ValueError: 996\n '
1623
1623
' +---------------- 2 ----------------\n '
1624
- ' | ExceptionGroup: eg995\n '
1624
+ ' | ExceptionGroup: eg995 (3 sub-exceptions) \n '
1625
1625
' +-+---------------- 1 ----------------\n '
1626
1626
' | ValueError: 995\n '
1627
1627
' +---------------- 2 ----------------\n '
1628
- ' | ExceptionGroup: eg994\n '
1628
+ ' | ExceptionGroup: eg994 (3 sub-exceptions) \n '
1629
1629
' +-+---------------- 1 ----------------\n '
1630
1630
' | ValueError: 994\n '
1631
1631
' +---------------- 2 ----------------\n '
1632
- ' | ExceptionGroup: eg993\n '
1632
+ ' | ExceptionGroup: eg993 (3 sub-exceptions) \n '
1633
1633
' +-+---------------- 1 ----------------\n '
1634
1634
' | ValueError: 993\n '
1635
1635
' +---------------- 2 ----------------\n '
1636
- ' | ExceptionGroup: eg992\n '
1636
+ ' | ExceptionGroup: eg992 (3 sub-exceptions) \n '
1637
1637
' +-+---------------- 1 ----------------\n '
1638
1638
' | ValueError: 992\n '
1639
1639
' +---------------- 2 ----------------\n '
1640
- ' | ExceptionGroup: eg991\n '
1640
+ ' | ExceptionGroup: eg991 (3 sub-exceptions) \n '
1641
1641
' +-+---------------- 1 ----------------\n '
1642
1642
' | ValueError: 991\n '
1643
1643
' +---------------- 2 ----------------\n '
1644
- ' | ExceptionGroup: eg990\n '
1644
+ ' | ExceptionGroup: eg990 (3 sub-exceptions) \n '
1645
1645
' +-+---------------- 1 ----------------\n '
1646
1646
' | ValueError: 990\n '
1647
1647
' +---------------- 2 ----------------\n '
@@ -1707,7 +1707,7 @@ def exc():
1707
1707
f' | File "{ __file__ } ", line { exc .__code__ .co_firstlineno + 9 } , in exc\n '
1708
1708
f' | raise ExceptionGroup("nested", excs)\n '
1709
1709
f' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n '
1710
- f' | ExceptionGroup: nested\n '
1710
+ f' | ExceptionGroup: nested (2 sub-exceptions) \n '
1711
1711
f' | >> Multi line note\n '
1712
1712
f' | >> Because I am such\n '
1713
1713
f' | >> an important exception.\n '
@@ -2460,7 +2460,7 @@ def test_exception_group_construction(self):
2460
2460
def test_exception_group_format_exception_only (self ):
2461
2461
teg = traceback .TracebackException (* self .eg_info )
2462
2462
formatted = '' .join (teg .format_exception_only ()).split ('\n ' )
2463
- expected = "ExceptionGroup: eg2\n " .split ('\n ' )
2463
+ expected = "ExceptionGroup: eg2 (2 sub-exceptions) \n " .split ('\n ' )
2464
2464
2465
2465
self .assertEqual (formatted , expected )
2466
2466
@@ -2476,13 +2476,13 @@ def test_exception_group_format(self):
2476
2476
f' | File "{ __file__ } ", line { lno_g + 23 } , in _get_exception_group' ,
2477
2477
f' | raise ExceptionGroup("eg2", [exc3, exc4])' ,
2478
2478
f' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^' ,
2479
- f' | ExceptionGroup: eg2' ,
2479
+ f' | ExceptionGroup: eg2 (2 sub-exceptions) ' ,
2480
2480
f' +-+---------------- 1 ----------------' ,
2481
2481
f' | Exception Group Traceback (most recent call last):' ,
2482
2482
f' | File "{ __file__ } ", line { lno_g + 16 } , in _get_exception_group' ,
2483
2483
f' | raise ExceptionGroup("eg1", [exc1, exc2])' ,
2484
2484
f' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^' ,
2485
- f' | ExceptionGroup: eg1' ,
2485
+ f' | ExceptionGroup: eg1 (2 sub-exceptions) ' ,
2486
2486
f' +-+---------------- 1 ----------------' ,
2487
2487
f' | Traceback (most recent call last):' ,
2488
2488
f' | File "{ __file__ } ", line { lno_g + 9 } , in _get_exception_group' ,
@@ -2531,9 +2531,9 @@ def test_max_group_width(self):
2531
2531
formatted = '' .join (teg .format ()).split ('\n ' )
2532
2532
2533
2533
expected = [
2534
- f' | ExceptionGroup: eg' ,
2534
+ f' | ExceptionGroup: eg (2 sub-exceptions) ' ,
2535
2535
f' +-+---------------- 1 ----------------' ,
2536
- f' | ExceptionGroup: eg1' ,
2536
+ f' | ExceptionGroup: eg1 (3 sub-exceptions) ' ,
2537
2537
f' +-+---------------- 1 ----------------' ,
2538
2538
f' | ValueError: 0' ,
2539
2539
f' +---------------- 2 ----------------' ,
@@ -2542,7 +2542,7 @@ def test_max_group_width(self):
2542
2542
f' | and 1 more exception' ,
2543
2543
f' +------------------------------------' ,
2544
2544
f' +---------------- 2 ----------------' ,
2545
- f' | ExceptionGroup: eg2' ,
2545
+ f' | ExceptionGroup: eg2 (10 sub-exceptions) ' ,
2546
2546
f' +-+---------------- 1 ----------------' ,
2547
2547
f' | TypeError: 0' ,
2548
2548
f' +---------------- 2 ----------------' ,
@@ -2563,11 +2563,11 @@ def test_max_group_depth(self):
2563
2563
formatted = '' .join (teg .format ()).split ('\n ' )
2564
2564
2565
2565
expected = [
2566
- f' | ExceptionGroup: exc' ,
2566
+ f' | ExceptionGroup: exc (3 sub-exceptions) ' ,
2567
2567
f' +-+---------------- 1 ----------------' ,
2568
2568
f' | ValueError: -2' ,
2569
2569
f' +---------------- 2 ----------------' ,
2570
- f' | ExceptionGroup: exc' ,
2570
+ f' | ExceptionGroup: exc (3 sub-exceptions) ' ,
2571
2571
f' +-+---------------- 1 ----------------' ,
2572
2572
f' | ValueError: -1' ,
2573
2573
f' +---------------- 2 ----------------' ,
0 commit comments