Fix #7445: a return annotation `None` is not converted to a hyperlink

This commit is contained in:
Takeshi KOMIYA committed 2020-04-10 02:07:02 +09:00
1 parent aca3f825f2
commit d9d381de11
3 files changed
+15 -1

No files matched your search

+7
View File
@@ -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"