mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-10-26 07:00:14 -05:00
Fix #7445: a return annotation `None` is not converted to a hyperlink
This commit is contained in:
1 parent
aca3f825f2
commit
d9d381de11
3 files changed
+15
-1
No files matched your search
@@ -239,6 +239,7 @@ def test_get_full_qualified_name():
|
||||
def test_parse_annotation():
|
||||
doctree = _parse_annotation("int")
|
||||
assert_node(doctree, ([pending_xref, "int"],))
|
||||
assert_node(doctree[0], pending_xref, refdomain="py", reftype="class", reftarget="int")
|
||||
|
||||
doctree = _parse_annotation("List[int]")
|
||||
assert_node(doctree, ([pending_xref, "List"],
|
||||
@@ -266,6 +267,12 @@ def test_parse_annotation():
|
||||
[pending_xref, "int"],
|
||||
[desc_sig_punctuation, "]"]))
|
||||
|
||||
# None type makes an object-reference (not a class reference)
|
||||
doctree = _parse_annotation("None")
|
||||
assert_node(doctree, ([pending_xref, "None"],))
|
||||
assert_node(doctree[0], pending_xref, refdomain="py", reftype="obj", reftarget="None")
|
||||
|
||||
|
||||
|
||||
def test_pyfunction_signature(app):
|
||||
text = ".. py:function:: hello(name: str) -> str"
|
||||
|
||||
Reference in new issue
Block a user