summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pydoc/test_pydoc.py
diff options
context:
space:
mode:
authorsobolevn <mail@sobolevn.me>2024-09-27 16:20:49 (GMT)
committerGitHub <noreply@github.com>2024-09-27 16:20:49 (GMT)
commit9c7657f09914254724683d91177aed7947637be5 (patch)
treea3866271b1a8ad5602e12f64ac03de1a7b463c66 /Lib/test/test_pydoc/test_pydoc.py
parent0a3577bdfcb7132c92a3f7fb2ac231bc346383c0 (diff)
downloadcpython-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.py8
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)