mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
py nodes, List
This commit is contained in:
@@ -138,7 +138,9 @@ def _parse_annotation(annotation: str, env: BuildEnvironment = None) -> List[Nod
|
||||
# once
|
||||
for elem in node.elts:
|
||||
result.extend(unparse(elem))
|
||||
result.append(addnodes.desc_sig_punctuation('', ', '))
|
||||
result.append(addnodes.desc_sig_punctuation('', ','))
|
||||
result.append(addnodes.desc_sig_space())
|
||||
result.pop()
|
||||
result.pop()
|
||||
result.append(addnodes.desc_sig_punctuation('', ']'))
|
||||
return result
|
||||
|
||||
@@ -310,11 +310,13 @@ def test_parse_annotation(app):
|
||||
[desc_sig_punctuation, "]"]))
|
||||
|
||||
doctree = _parse_annotation("Callable[[int, int], int]", app.env)
|
||||
print(doctree)
|
||||
assert_node(doctree, ([pending_xref, "Callable"],
|
||||
[desc_sig_punctuation, "["],
|
||||
[desc_sig_punctuation, "["],
|
||||
[pending_xref, "int"],
|
||||
[desc_sig_punctuation, ", "],
|
||||
[desc_sig_punctuation, ","],
|
||||
desc_sig_space,
|
||||
[pending_xref, "int"],
|
||||
[desc_sig_punctuation, "]"],
|
||||
[desc_sig_punctuation, ", "],
|
||||
|
||||
Reference in New Issue
Block a user