summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2015-04-11 16:39:59 (GMT)
committerEthan Furman <ethan@stoneleaf.us>2015-04-11 16:39:59 (GMT)
commit3323da92e7093c8841700f7379088916e60d056d (patch)
tree949f33567c2a4e11f17d81e83af8e4355097fe50
parent2995cc68550a62657339d3455ecb2e37a926ad7c (diff)
downloadcpython-3323da92e7093c8841700f7379088916e60d056d.zip
cpython-3323da92e7093c8841700f7379088916e60d056d.tar.gz
cpython-3323da92e7093c8841700f7379088916e60d056d.tar.bz2
Issue23826: fix doc test for -OO runs
-rw-r--r--Lib/test/test_enum.py39
1 files changed, 35 insertions, 4 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py
index 278266e..1e8c080 100644
--- a/Lib/test/test_enum.py
+++ b/Lib/test/test_enum.py
@@ -1556,7 +1556,7 @@ class TestUnique(unittest.TestCase):
turkey = 3
-expected_help_output = """
+expected_help_output_with_docs = """\
Help on class Color in module %s:
class Color(enum.Enum)
@@ -1593,8 +1593,36 @@ class Color(enum.Enum)
| Returns a mapping of member name->value.
|\x20\x20\x20\x20\x20\x20
| This mapping lists all enum members, including aliases. Note that this
- | is a read-only view of the internal mapping.
-""".strip()
+ | is a read-only view of the internal mapping."""
+
+expected_help_output_without_docs = """\
+Help on class Color in module %s:
+
+class Color(enum.Enum)
+ | Method resolution order:
+ | Color
+ | enum.Enum
+ | builtins.object
+ |\x20\x20
+ | Data and other attributes defined here:
+ |\x20\x20
+ | blue = <Color.blue: 3>
+ |\x20\x20
+ | green = <Color.green: 2>
+ |\x20\x20
+ | red = <Color.red: 1>
+ |\x20\x20
+ | ----------------------------------------------------------------------
+ | Data descriptors inherited from enum.Enum:
+ |\x20\x20
+ | name
+ |\x20\x20
+ | value
+ |\x20\x20
+ | ----------------------------------------------------------------------
+ | Data descriptors inherited from enum.EnumMeta:
+ |\x20\x20
+ | __members__"""
class TestStdLib(unittest.TestCase):
@@ -1605,7 +1633,10 @@ class TestStdLib(unittest.TestCase):
def test_pydoc(self):
# indirectly test __objclass__
- expected_text = expected_help_output % __name__
+ if StrEnum.__doc__ is None:
+ expected_text = expected_help_output_without_docs % __name__
+ else:
+ expected_text = expected_help_output_with_docs % __name__
output = StringIO()
helper = pydoc.Helper(output=output)
helper(self.Color)