mirror of
https://github.com/python/cpython.git
synced 2025-08-24 10:45:53 +00:00
bpo-32492: Tweak _collections._tuplegetter. (GH-11367)
* Replace the docstrings cache with sys.intern(). * Improve tests. * Unify names of tp_descr_get and tp_descr_set functions.
This commit is contained in:
parent
5c117dd227
commit
052b2dfdc9
4 changed files with 75 additions and 37 deletions
|
@ -687,6 +687,16 @@ class PydocDocTest(unittest.TestCase):
|
|||
finally:
|
||||
pydoc.getpager = getpager_old
|
||||
|
||||
def test_namedtuple_fields(self):
|
||||
Person = namedtuple('Person', ['nickname', 'firstname'])
|
||||
with captured_stdout() as help_io:
|
||||
pydoc.help(Person)
|
||||
helptext = help_io.getvalue()
|
||||
self.assertIn("nickname", helptext)
|
||||
self.assertIn("firstname", helptext)
|
||||
self.assertIn("Alias for field number 0", helptext)
|
||||
self.assertIn("Alias for field number 1", helptext)
|
||||
|
||||
def test_namedtuple_public_underscore(self):
|
||||
NT = namedtuple('NT', ['abc', 'def'], rename=True)
|
||||
with captured_stdout() as help_io:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue