mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '3.x' into master_with_merged_3.x
This commit is contained in:
@@ -431,6 +431,20 @@ def test_pyfunction_with_number_literals(app):
|
||||
[nodes.inline, "1_6_0"])])])
|
||||
|
||||
|
||||
def test_pyfunction_with_union_type_operator(app):
|
||||
text = ".. py:function:: hello(age: int | None)"
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
assert_node(doctree[1][0][1],
|
||||
[desc_parameterlist, ([desc_parameter, ([desc_sig_name, "age"],
|
||||
[desc_sig_punctuation, ":"],
|
||||
" ",
|
||||
[desc_sig_name, ([pending_xref, "int"],
|
||||
" ",
|
||||
[desc_sig_punctuation, "|"],
|
||||
" ",
|
||||
[pending_xref, "None"])])])])
|
||||
|
||||
|
||||
def test_optional_pyfunction_signature(app):
|
||||
text = ".. py:function:: compile(source [, filename [, symbol]]) -> ast object"
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
@@ -498,6 +512,20 @@ def test_pydata_signature_old(app):
|
||||
domain="py", objtype="data", noindex=False)
|
||||
|
||||
|
||||
def test_pydata_with_union_type_operator(app):
|
||||
text = (".. py:data:: version\n"
|
||||
" :type: int | str")
|
||||
doctree = restructuredtext.parse(app, text)
|
||||
assert_node(doctree[1][0],
|
||||
([desc_name, "version"],
|
||||
[desc_annotation, (": ",
|
||||
[pending_xref, "int"],
|
||||
" ",
|
||||
[desc_sig_punctuation, "|"],
|
||||
" ",
|
||||
[pending_xref, "str"])]))
|
||||
|
||||
|
||||
def test_pyobject_prefix(app):
|
||||
text = (".. py:class:: Foo\n"
|
||||
"\n"
|
||||
|
||||
Reference in New Issue
Block a user