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.
........
This commit is contained in:
R. David Murray 2010-02-24 01:46:21 +00:00
parent 72aee3dcab
commit 378c0cf5ab
19 changed files with 211 additions and 42 deletions

View file

@ -1,4 +1,5 @@
import functools
import sys
import unittest
from test import support
from weakref import proxy
@ -180,7 +181,7 @@ class TestUpdateWrapper(unittest.TestCase):
for key in wrapped_attr:
self.assertTrue(wrapped_attr[key] is wrapper_attr[key])
def test_default_update(self):
def _default_update(self):
def f():
"""This is a test"""
pass
@ -188,11 +189,20 @@ class TestUpdateWrapper(unittest.TestCase):
def wrapper():
pass
functools.update_wrapper(wrapper, f)
return wrapper, f
def test_default_update(self):
wrapper, f = self._default_update()
self.check_wrapper(wrapper, f)
self.assertEqual(wrapper.__name__, 'f')
self.assertEqual(wrapper.__doc__, 'This is a test')
self.assertEqual(wrapper.attr, 'This is also a test')
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_default_update_doc(self):
wrapper, f = self._default_update()
self.assertEqual(wrapper.__doc__, 'This is a test')
def test_no_update(self):
def f():
"""This is a test"""
@ -233,7 +243,7 @@ class TestUpdateWrapper(unittest.TestCase):
class TestWraps(TestUpdateWrapper):
def test_default_update(self):
def _default_update(self):
def f():
"""This is a test"""
pass
@ -242,10 +252,19 @@ class TestWraps(TestUpdateWrapper):
def wrapper():
pass
self.check_wrapper(wrapper, f)
return wrapper
def test_default_update(self):
wrapper = self._default_update()
self.assertEqual(wrapper.__name__, 'f')
self.assertEqual(wrapper.__doc__, 'This is a test')
self.assertEqual(wrapper.attr, 'This is also a test')
@unittest.skipIf(not sys.flags.optimize <= 1,
"Docstrings are omitted with -O2 and above")
def test_default_update_doc(self):
wrapper = self._default_update()
self.assertEqual(wrapper.__doc__, 'This is a test')
def test_no_update(self):
def f():
"""This is a test"""
@ -350,7 +369,6 @@ class TestReduce(unittest.TestCase):
def test_main(verbose=None):
import sys
test_classes = (
TestPartial,
TestPartialSubclass,