From 056eb02719497a700e332d2ad69c2b11db0e3552 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 19 Feb 2014 23:05:12 +0200 Subject: Issue #20654: Fixed pydoc for enums with zero value. Patch by Vajrasky Kok. --- Lib/test/test_pydoc.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Lib/test/test_pydoc.py') diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index 105116a5c0..9909b9ae53 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -386,6 +386,16 @@ class PydocDocTest(unittest.TestCase): print_diffs(expected_text, result) self.fail("outputs are not equal, see diff above") + def test_text_enum_member_with_value_zero(self): + # Test issue #20654 to ensure enum member with value 0 can be + # displayed. It used to throw KeyError: 'zero'. + import enum + class BinaryInteger(enum.IntEnum): + zero = 0 + one = 1 + doc = pydoc.render_doc(BinaryInteger) + self.assertIn('', doc) + def test_issue8225(self): # Test issue8225 to ensure no doc link appears for xml.etree result, doc_loc = get_pydoc_text(xml.etree) -- cgit v1.2.1