summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_contextlib.py8
-rw-r--r--Lib/test/test_with.py6
2 files changed, 11 insertions, 3 deletions
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py
index adafc9fd4f..78741f5f2b 100644
--- a/Lib/test/test_contextlib.py
+++ b/Lib/test/test_contextlib.py
@@ -147,6 +147,14 @@ def woohoo():
baz = self._create_contextmanager_attribs()(None)
self.assertEqual(baz.__doc__, "Whee!")
+ def test_keywords(self):
+ # Ensure no keyword arguments are inhibited
+ @contextmanager
+ def woohoo(self, func, args, kwds):
+ yield (self, func, args, kwds)
+ with woohoo(self=11, func=22, args=33, kwds=44) as target:
+ self.assertEqual(target, (11, 22, 33, 44))
+
class ClosingTestCase(unittest.TestCase):
diff --git a/Lib/test/test_with.py b/Lib/test/test_with.py
index 5dbd1e6325..e8d789bc2c 100644
--- a/Lib/test/test_with.py
+++ b/Lib/test/test_with.py
@@ -11,8 +11,8 @@ from contextlib import _GeneratorContextManager, contextmanager
class MockContextManager(_GeneratorContextManager):
- def __init__(self, func, *args, **kwds):
- super().__init__(func, *args, **kwds)
+ def __init__(self, *args):
+ super().__init__(*args)
self.enter_called = False
self.exit_called = False
self.exit_args = None
@@ -30,7 +30,7 @@ class MockContextManager(_GeneratorContextManager):
def mock_contextmanager(func):
def helper(*args, **kwds):
- return MockContextManager(func, *args, **kwds)
+ return MockContextManager(func, args, kwds)
return helper