diff options
Diffstat (limited to 'Lib/test/test_pydoc.py')
| -rw-r--r-- | Lib/test/test_pydoc.py | 25 | 
1 files changed, 23 insertions, 2 deletions
| diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index aee979b..5174d56 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -83,6 +83,8 @@ CLASSES       |  Data and other attributes defined here:       |\x20\x20       |  NO_MEANING = 'eggs' +     |\x20\x20 +     |  __annotations__ = {'NO_MEANING': <class 'str'>}  \x20\x20\x20\x20      class C(builtins.object)       |  Methods defined here: @@ -195,6 +197,8 @@ Data descriptors defined here:<br>  Data and other attributes defined here:<br>  <dl><dt><strong>NO_MEANING</strong> = 'eggs'</dl> +<dl><dt><strong>__annotations__</strong> = {'NO_MEANING': <class 'str'>}</dl> +  </td></tr></table> <p>  <table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">  <tr bgcolor="#ffc8d8"> @@ -263,7 +267,7 @@ Use help() to get the interactive help utility.  Use help(str) for help on the str class.'''.replace('\n', os.linesep)  # output pattern for module with bad imports -badimport_pattern = "problem in %s - ImportError: No module named %r" +badimport_pattern = "problem in %s - ModuleNotFoundError: No module named %r"  expected_dynamicattribute_pattern = """  Help on class DA in module %s: @@ -638,8 +642,9 @@ class PydocDocTest(unittest.TestCase):          del expected['__doc__']          del expected['__class__']          # inspect resolves descriptors on type into methods, but vars doesn't, -        # so we need to update __subclasshook__. +        # so we need to update __subclasshook__ and __init_subclass__.          expected['__subclasshook__'] = TestClass.__subclasshook__ +        expected['__init_subclass__'] = TestClass.__init_subclass__          methods = pydoc.allmethods(TestClass)          self.assertDictEqual(methods, expected) @@ -855,6 +860,22 @@ class TestDescriptions(unittest.TestCase):          self.assertEqual(self._get_summary_line(t.wrap),              "wrap(text) method of textwrap.TextWrapper instance") +    def test_field_order_for_named_tuples(self): +        Person = namedtuple('Person', ['nickname', 'firstname', 'agegroup']) +        s = pydoc.render_doc(Person) +        self.assertLess(s.index('nickname'), s.index('firstname')) +        self.assertLess(s.index('firstname'), s.index('agegroup')) + +        class NonIterableFields: +            _fields = None + +        class NonHashableFields: +            _fields = [[]] + +        # Make sure these doesn't fail +        pydoc.render_doc(NonIterableFields) +        pydoc.render_doc(NonHashableFields) +      @requires_docstrings      def test_bound_builtin_method(self):          s = StringIO() | 
