Skip to content

Commit 1f01719

Browse files
author
Jarrad Whitaker
committed
sphinx-doc#10048 - add failing test
1 parent 6402acd commit 1f01719

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

tests/roots/test-ext-autosummary-imported_members/conf.py

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66
extensions = ['sphinx.ext.autosummary']
77
autosummary_generate = True
88
autosummary_imported_members = True
9+
10+
# test for #10058 - shoud be scoped just to test_autosummary_imported_members_table_10058
11+
autodoc_class_signature = 'separated'

tests/roots/test-ext-autosummary-imported_members/index.rst

+7
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ test-ext-autosummary-mock_imports
55
:toctree: generated
66

77
autosummary_dummy_package
8+
9+
.. currentmodule:: autosummary_dummy_package
10+
11+
.. autosummary::
12+
13+
foo
14+
Bar

tests/test_ext_autosummary.py

+44
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,50 @@ def test_autosummary_imported_members(app, status, warning):
535535
finally:
536536
sys.modules.pop('autosummary_dummy_package', None)
537537

538+
@pytest.mark.sphinx('dummy', testroot='ext-autosummary-imported_members')
539+
def test_autosummary_imported_members_table_10058(app, status, warning):
540+
try:
541+
#app.env.config.autodoc_class_signature = 'separated'
542+
app.build()
543+
544+
doctree = app.env.get_doctree('index')
545+
546+
assert_node(doctree, (nodes.section,))
547+
# nodes.paragraph,
548+
# addnodes.tabular_col_spec,
549+
# autosummary_table,
550+
# [autosummary_toc, addnodes.toctree]))
551+
assert_node(doctree[0], (
552+
nodes.title,
553+
addnodes.tabular_col_spec,
554+
autosummary_table,
555+
autosummary_toc,
556+
addnodes.tabular_col_spec,
557+
autosummary_table
558+
))
559+
560+
table = list(doctree[0].traverse(autosummary_table))[1]
561+
562+
assert_node(table, [
563+
autosummary_table,
564+
nodes.table,
565+
nodes.tgroup,
566+
(nodes.colspec, nodes.colspec, nodes.tbody)
567+
])
568+
569+
tbody = table.next_node(nodes.tbody)
570+
571+
assert_node(tbody, (
572+
[nodes.row, (nodes.entry, nodes.entry)],
573+
[nodes.row, (nodes.entry, nodes.entry)]
574+
))
575+
576+
assert 'foo' in tbody[0][0].next_node(nodes.Text).astext()
577+
assert 'Bar' in tbody[1][0].next_node(nodes.Text).astext()
578+
579+
finally:
580+
sys.modules.pop('autosummary_dummy_package', None)
581+
538582

539583
@pytest.mark.sphinx(testroot='ext-autodoc',
540584
confoverrides={'extensions': ['sphinx.ext.autosummary']})

0 commit comments

Comments
 (0)