diff -r 7c8ad0d02664 Lib/ctypes/test/test_win32.py --- a/Lib/ctypes/test/test_win32.py Sat Jan 26 12:13:40 2013 +0200 +++ b/Lib/ctypes/test/test_win32.py Sat Jan 26 15:31:53 2013 +0200 @@ -60,7 +60,9 @@ def test_COMError(self): from _ctypes import COMError - self.assertEqual(COMError.__doc__, "Raised when a COM method call failed.") + if ''.__doc__: # if dostrings are enabled + self.assertEqual(COMError.__doc__, + "Raised when a COM method call failed.") ex = COMError(-1, "text", ("details",)) self.assertEqual(ex.hresult, -1) diff -r 7c8ad0d02664 Lib/distutils/tests/test_build_ext.py --- a/Lib/distutils/tests/test_build_ext.py Sat Jan 26 12:13:40 2013 +0200 +++ b/Lib/distutils/tests/test_build_ext.py Sat Jan 26 15:31:53 2013 +0200 @@ -77,8 +77,9 @@ self.assertEqual(xx.foo(2, 5), 7) self.assertEqual(xx.foo(13,15), 28) self.assertEqual(xx.new().demo(), None) - doc = 'This is a template module just for instruction.' - self.assertEqual(xx.__doc__, doc) + if ''.__doc__: # if dostrings are enabled + doc = 'This is a template module just for instruction.' + self.assertEqual(xx.__doc__, doc) self.assertTrue(isinstance(xx.Null(), xx.Null)) self.assertTrue(isinstance(xx.Str(), xx.Str)) diff -r 7c8ad0d02664 Lib/test/test_bytes.py --- a/Lib/test/test_bytes.py Sat Jan 26 12:13:40 2013 +0200 +++ b/Lib/test/test_bytes.py Sat Jan 26 15:31:53 2013 +0200 @@ -925,6 +925,9 @@ self.assertEqual(bytes(b"abc") < b"ab", False) self.assertEqual(bytes(b"abc") <= b"ab", False) + @unittest.skipUnless(''.__doc__, "Docstrings are disabled") + @unittest.skipIf(sys.flags.optimize >= 2, + "Docstrings are omitted with -O2 and above") def test_doc(self): self.assertIsNotNone(bytearray.__doc__) self.assertTrue(bytearray.__doc__.startswith("bytearray("), bytearray.__doc__) diff -r 7c8ad0d02664 Lib/test/test_functools.py --- a/Lib/test/test_functools.py Sat Jan 26 12:13:40 2013 +0200 +++ b/Lib/test/test_functools.py Sat Jan 26 15:31:53 2013 +0200 @@ -196,6 +196,7 @@ self.assertEqual(wrapper.__name__, 'f') self.assertEqual(wrapper.attr, 'This is also a test') + @unittest.skipUnless(''.__doc__, "Docstrings are disabled") @unittest.skipIf(sys.flags.optimize >= 2, "Docstrings are omitted with -O2 and above") def test_default_update_doc(self): diff -r 7c8ad0d02664 Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py Sat Jan 26 12:13:40 2013 +0200 +++ b/Lib/test/test_pydoc.py Sat Jan 26 15:31:53 2013 +0200 @@ -16,6 +16,14 @@ from test import pydoc_mod +if ''.__doc__: # if docstrings are enabled + expected_data_docstrings = ( + 'dictionary for instance variables (if defined)', + 'list of weak references to the object (if defined)', + ) +else: + expected_data_docstrings = ('', '', '', '') + expected_text_pattern = \ """ NAME @@ -40,11 +48,9 @@ class B(__builtin__.object) | Data descriptors defined here: |\x20\x20 - | __dict__ - | dictionary for instance variables (if defined) + | __dict__%s |\x20\x20 - | __weakref__ - | list of weak references to the object (if defined) + | __weakref__%s |\x20\x20 | ---------------------------------------------------------------------- | Data and other attributes defined here: @@ -75,6 +81,9 @@ Nobody """.strip() +expected_text_data_docstrings = tuple('\n | ' + s if s else '' + for s in expected_data_docstrings) + expected_html_pattern = \ """
Data descriptors defined here:
Data and other attributes defined here: @@ -168,6 +177,8 @@ | Nobody |