diff --git a/Lib/ctypes/test/test_win32.py b/Lib/ctypes/test/test_win32.py index 2534a748cd9..77e6fead56f 100644 --- a/Lib/ctypes/test/test_win32.py +++ b/Lib/ctypes/test/test_win32.py @@ -3,6 +3,7 @@ from ctypes import * from ctypes.test import is_resource_enabled import unittest, sys +from test import test_support as support import _ctypes_test @@ -60,7 +61,9 @@ if sys.platform == "win32": def test_COMError(self): from _ctypes import COMError - self.assertEqual(COMError.__doc__, "Raised when a COM method call failed.") + if support.HAVE_DOCSTRINGS: + self.assertEqual(COMError.__doc__, + "Raised when a COM method call failed.") ex = COMError(-1, "text", ("details",)) self.assertEqual(ex.hresult, -1) diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py index b71cc983bee..f6a503b538e 100644 --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -77,8 +77,9 @@ class BuildExtTestCase(support.TempdirManager, 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 test_support.HAVE_DOCSTRINGS: + 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 --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index a713314f160..af19ef7fec7 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -232,6 +232,7 @@ class TestUpdateWrapper(unittest.TestCase): self.assertEqual(wrapper.attr, 'This is a different test') self.assertEqual(wrapper.dict_attr, f.dict_attr) + @test_support.requires_docstrings def test_builtin_update(self): # Test for bug #1576241 def wrapper(): diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index d95e7069ce1..382d6dc878f 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -16,6 +16,14 @@ from test.test_support import ( from test import pydoc_mod +if test.test_support.HAVE_DOCSTRINGS: + 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 @@ CLASSES 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 @@ CREDITS 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 @@ war | Nobody |