diff options
author | sobolevn <mail@sobolevn.me> | 2024-09-27 16:20:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-27 16:20:49 (GMT) |
commit | 9c7657f09914254724683d91177aed7947637be5 (patch) | |
tree | a3866271b1a8ad5602e12f64ac03de1a7b463c66 /Lib/test/test_pydoc/test_pydoc.py | |
parent | 0a3577bdfcb7132c92a3f7fb2ac231bc346383c0 (diff) | |
download | cpython-9c7657f09914254724683d91177aed7947637be5.zip cpython-9c7657f09914254724683d91177aed7947637be5.tar.gz cpython-9c7657f09914254724683d91177aed7947637be5.tar.bz2 |
gh-113878: Add `doc` parameter to `dataclasses.field` (gh-114051)
If using `slots=True`, the `doc` parameter ends up in the `__slots__` dict. The `doc` parameter is also in the corresponding `Field` object.
Diffstat (limited to 'Lib/test/test_pydoc/test_pydoc.py')
-rw-r--r-- | Lib/test/test_pydoc/test_pydoc.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_pydoc/test_pydoc.py b/Lib/test/test_pydoc/test_pydoc.py index 2dba077..776e02f 100644 --- a/Lib/test/test_pydoc/test_pydoc.py +++ b/Lib/test/test_pydoc/test_pydoc.py @@ -463,6 +463,14 @@ class PydocDocTest(unittest.TestCase): doc = pydoc.render_doc(BinaryInteger) self.assertIn('BinaryInteger.zero', doc) + def test_slotted_dataclass_with_field_docs(self): + import dataclasses + @dataclasses.dataclass(slots=True) + class My: + x: int = dataclasses.field(doc='Docstring for x') + doc = pydoc.render_doc(My) + self.assertIn('Docstring for x', doc) + def test_mixed_case_module_names_are_lower_cased(self): # issue16484 doc_link = get_pydoc_link(xml.etree.ElementTree) |