Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_contextlib.py @ 59091:8d3ff2fbbe4b
Merged revisions 78351 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78351 | r.david.murray | 2010-02-22 19:24:49 -0500 (Mon, 22 Feb 2010) | 5 lines
Issue 6292: for the moment at least, the test suite passes if run
with -OO. Tests requiring docstrings are skipped. Patch by
Brian Curtin, thanks to Matias Torchinsky for helping review and
improve the patch.
........
| author | R. David Murray <rdmurray@bitdance.com> |
|---|---|
| date | Wed, 24 Feb 2010 01:46:21 +0000 |
| parents | b168dccee602 |
| children | b93cfafcdcad |
line wrap: on
line diff
--- a/Lib/test/test_contextlib.py Wed Feb 24 00:10:48 2010 +0000 +++ b/Lib/test/test_contextlib.py Wed Feb 24 01:46:21 2010 +0000 @@ -4,6 +4,7 @@ import sys import os import decimal +import sys import tempfile import unittest import threading @@ -85,7 +86,7 @@ raise ZeroDivisionError(999) self.assertEqual(state, [1, 42, 999]) - def test_contextmanager_attribs(self): + def _create_contextmanager_attribs(self): def attribs(**kw): def decorate(func): for k,v in kw.items(): @@ -96,8 +97,17 @@ @attribs(foo='bar') def baz(spam): """Whee!""" + return baz + + def test_contextmanager_attribs(self): + baz = self._create_contextmanager_attribs() self.assertEqual(baz.__name__,'baz') self.assertEqual(baz.foo, 'bar') + + @unittest.skipIf(sys.flags.optimize >= 2, + "Docstrings are omitted with -O2 and above") + def test_contextmanager_doc_attrib(self): + baz = self._create_contextmanager_attribs() self.assertEqual(baz.__doc__, "Whee!") class ClosingTestCase(unittest.TestCase):
