summaryrefslogtreecommitdiff
path: root/Lib/test/test_with.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_with.py')
-rw-r--r--Lib/test/test_with.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_with.py b/Lib/test/test_with.py
index b1d7a15b5e..f21bf65fed 100644
--- a/Lib/test/test_with.py
+++ b/Lib/test/test_with.py
@@ -7,7 +7,7 @@ __email__ = "mbland at acm dot org"
import sys
import unittest
from collections import deque
-from contextlib import _GeneratorContextManager, contextmanager
+from contextlib import _GeneratorContextManager, contextmanager, nullcontext
class MockContextManager(_GeneratorContextManager):
@@ -641,6 +641,12 @@ class AssignmentTargetTestCase(unittest.TestCase):
self.assertEqual(blah.two, 2)
self.assertEqual(blah.three, 3)
+ def testWithExtendedTargets(self):
+ with nullcontext(range(1, 5)) as (a, *b, c):
+ self.assertEqual(a, 1)
+ self.assertEqual(b, [2, 3])
+ self.assertEqual(c, 4)
+
class ExitSwallowsExceptionTestCase(unittest.TestCase):