Skip to content

Commit

Permalink
Domain Python: Fix tests due to new index/target node order
Browse files Browse the repository at this point in the history
The post transform ReorderConsecutiveTargetAndIndexNodes reorders index
and target nodes.  A snipped like::

   .. py:module:: mymodule
   .. py:data:: myvar

generates the nodes::

   <index mymodule>
   <target mymodule>
   <index myvar>
   <descr myvar>

which get reordered to::

   <index mymodule>
   <index myvar>
   <target mymodule>
   <descr myvar>
  • Loading branch information
latosha-maltba committed May 29, 2022
1 parent 6f61793 commit 3bdd11c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test_domain_py.py
Expand Up @@ -616,8 +616,8 @@ def test_pydata(app):
domain = app.env.get_domain('py')
doctree = restructuredtext.parse(app, text)
assert_node(doctree, (addnodes.index,
nodes.target,
addnodes.index,
nodes.target,
[desc, ([desc_signature, ([desc_addname, "example."],
[desc_name, "var"],
[desc_annotation, ([desc_sig_punctuation, ':'],
Expand All @@ -641,8 +641,8 @@ def test_pyfunction(app):
[desc_parameterlist, ()])],
[desc_content, ()])],
addnodes.index,
nodes.target,
addnodes.index,
nodes.target,
[desc, ([desc_signature, ([desc_annotation, ([desc_sig_keyword, 'async'],
desc_sig_space)],
[desc_addname, "example."],
Expand All @@ -653,7 +653,7 @@ def test_pyfunction(app):
entries=[('pair', 'built-in function; func1()', 'func1', '', None)])
assert_node(doctree[2], addnodes.index,
entries=[('pair', 'module; example', 'module-example', '', None)])
assert_node(doctree[4], addnodes.index,
assert_node(doctree[3], addnodes.index,
entries=[('single', 'func2() (in module example)', 'example.func2', '', None)])

assert 'func1' in domain.objects
Expand Down Expand Up @@ -1011,8 +1011,8 @@ def test_info_field_list(app):
print(doctree)

assert_node(doctree, (addnodes.index,
nodes.target,
addnodes.index,
nodes.target,
[desc, ([desc_signature, ([desc_annotation, ("class", desc_sig_space)],
[desc_addname, "example."],
[desc_name, "Class"])],
Expand Down Expand Up @@ -1102,8 +1102,8 @@ def test_info_field_list_piped_type(app):

assert_node(doctree,
(addnodes.index,
nodes.target,
addnodes.index,
nodes.target,
[desc, ([desc_signature, ([desc_annotation, ("class", desc_sig_space)],
[desc_addname, "example."],
[desc_name, "Class"])],
Expand Down Expand Up @@ -1136,8 +1136,8 @@ def test_info_field_list_Literal(app):

assert_node(doctree,
(addnodes.index,
nodes.target,
addnodes.index,
nodes.target,
[desc, ([desc_signature, ([desc_annotation, ("class", desc_sig_space)],
[desc_addname, "example."],
[desc_name, "Class"])],
Expand Down

0 comments on commit 3bdd11c

Please sign in to comment.