Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update test_with from CPython 3.10.6
  • Loading branch information
CPython Developers authored and youknowone committed Aug 14, 2022
commit 3c5ab3a8ef1b3d175ceba9f0982221c8bde4f85c
8 changes: 7 additions & 1 deletion Lib/test/test_with.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys
import unittest
from collections import deque
from contextlib import _GeneratorContextManager, contextmanager
from contextlib import _GeneratorContextManager, contextmanager, nullcontext


class MockContextManager(_GeneratorContextManager):
Expand Down Expand Up @@ -641,6 +641,12 @@ class B: pass
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):

Expand Down