diff options
author | Guido van Rossum <guido@python.org> | 2006-05-02 19:47:52 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-05-02 19:47:52 (GMT) |
commit | da5b701aeef755f2317a41e36cc950cfdc0c95cb (patch) | |
tree | 11a37e4e8714ffbccce921aa0ef1878b7dc779b2 /Lib/test/test_contextlib.py | |
parent | 8f6cbe150228f175b57b7a774d0a630febe72244 (diff) | |
download | cpython-da5b701aeef755f2317a41e36cc950cfdc0c95cb.zip cpython-da5b701aeef755f2317a41e36cc950cfdc0c95cb.tar.gz cpython-da5b701aeef755f2317a41e36cc950cfdc0c95cb.tar.bz2 |
Get rid of __context__, per the latest changes to PEP 343 and python-dev
discussion.
There are two places of documentation that still mention __context__:
Doc/lib/libstdtypes.tex -- I wasn't quite sure how to rewrite that without
spending a whole lot of time thinking about it; and whatsnew, which Andrew
usually likes to change himself.
Diffstat (limited to 'Lib/test/test_contextlib.py')
-rw-r--r-- | Lib/test/test_contextlib.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py index 53f23b2..8d3dd1a 100644 --- a/Lib/test/test_contextlib.py +++ b/Lib/test/test_contextlib.py @@ -51,7 +51,7 @@ class ContextManagerTestCase(unittest.TestCase): @contextfactory def whee(): yield - ctx = whee().__context__() + ctx = whee() ctx.__enter__() # Calling __exit__ should not result in an exception self.failIf(ctx.__exit__(TypeError, TypeError("foo"), None)) @@ -63,7 +63,7 @@ class ContextManagerTestCase(unittest.TestCase): yield except: yield - ctx = whoo().__context__() + ctx = whoo() ctx.__enter__() self.assertRaises( RuntimeError, ctx.__exit__, TypeError, TypeError("foo"), None @@ -152,8 +152,6 @@ class NestedTestCase(unittest.TestCase): def a(): yield 1 class b(object): - def __context__(self): - return self def __enter__(self): return 2 def __exit__(self, *exc_info): @@ -341,12 +339,12 @@ class DecimalContextTestCase(unittest.TestCase): orig_context = ctx.copy() try: ctx.prec = save_prec = decimal.ExtendedContext.prec + 5 - with decimal.ExtendedContext: + with decimal.ExtendedContext.context_manager(): self.assertEqual(decimal.getcontext().prec, decimal.ExtendedContext.prec) self.assertEqual(decimal.getcontext().prec, save_prec) try: - with decimal.ExtendedContext: + with decimal.ExtendedContext.context_manager(): self.assertEqual(decimal.getcontext().prec, decimal.ExtendedContext.prec) 1/0 |