summaryrefslogtreecommitdiff
path: root/Lib/test/test_with.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2020-10-19 15:50:36 +0100
committerGitHub <noreply@github.com>2020-10-19 15:50:36 +0100
commitc82f10450c547eb94a04ee17b7c816ff31948297 (patch)
treead305c05c5745e1a5e7c136545bec7eefa741e32 /Lib/test/test_with.py
parenteee6bb50c69d94280f43b47390ea9d1b5f42930c (diff)
parentb580ed1d9d55461d8dde027411b90be26cae131e (diff)
downloadcpython-git-bpo-39107.tar.gz
Merge branch 'master' into bpo-39107bpo-39107
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):