mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-10-12 08:25:01 -05:00
autodoc: Ensure type statements don't inherit docstrings (#14068)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
This commit is contained in:
1 parent
22bb79ead7
commit
707f210f65
3 files changed
+23
-1
No files matched your search
@@ -22,6 +22,8 @@ class Foo:
|
||||
type Pep695Alias = Foo
|
||||
"""This is PEP695 type alias."""
|
||||
|
||||
type Pep695AliasUndocumented = Foo
|
||||
|
||||
TypeAliasTypeExplicit = TypeAliasType('TypeAliasTypeExplicit', Foo) # NoQA: UP040
|
||||
"""This is an explicitly constructed typing.TypeAlias."""
|
||||
|
||||
|
||||
@@ -2292,6 +2292,12 @@ def test_autodoc_pep695_type_alias() -> None:
|
||||
' This is PEP695 type alias of PEP695 alias.',
|
||||
'',
|
||||
'',
|
||||
# Undocumented alias should not inherit any documentation
|
||||
'.. py:type:: Pep695AliasUndocumented',
|
||||
' :module: target.pep695',
|
||||
' :canonical: ~target.pep695.Foo',
|
||||
'',
|
||||
'',
|
||||
'.. py:type:: Pep695AliasUnion',
|
||||
' :module: target.pep695',
|
||||
' :canonical: str | int',
|
||||
|
||||
Reference in new issue
Block a user