[Python-checkins] cpython (2.7): Issue #24336: Backported test for contextmanager. Patch by Martin Panter.
serhiy.storchaka
python-checkins at python.org
Sun Jun 28 16:12:23 CEST 2015
https://hg.python.org/cpython/rev/85c78d4db242
changeset: 96701:85c78d4db242
branch: 2.7
parent: 96692:4f48b1e982ca
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sun Jun 28 17:11:51 2015 +0300
summary:
Issue #24336: Backported test for contextmanager. Patch by Martin Panter.
files:
Lib/test/test_contextlib.py | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py
--- a/Lib/test/test_contextlib.py
+++ b/Lib/test/test_contextlib.py
@@ -106,6 +106,14 @@
baz = self._create_contextmanager_attribs()
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 NestedTestCase(unittest.TestCase):
# XXX This needs more work
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list