diff --git a/pyproject.toml b/pyproject.toml index 5ef7cb1493..011b6d7012 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -223,7 +223,6 @@ module = [ "tests.test_config.test_config", # tests/test_directives "tests.test_directives.test_directive_other", - "tests.test_directives.test_directive_patch", # tests/test_domains "tests.test_domains.test_domain_c", "tests.test_domains.test_domain_cpp", diff --git a/tests/test_directives/test_directive_patch.py b/tests/test_directives/test_directive_patch.py index c24eb5a7c6..c927db13d4 100644 --- a/tests/test_directives/test_directive_patch.py +++ b/tests/test_directives/test_directive_patch.py @@ -47,8 +47,13 @@ def test_code_directive(app: SphinxTestApp) -> None: ) +def _as_element(node: nodes.Node) -> nodes.Element: + assert isinstance(node, nodes.Element) + return node + + @pytest.mark.sphinx('html', testroot='directive-csv-table') -def test_csv_table_directive(app): +def test_csv_table_directive(app: SphinxTestApp) -> None: # relative path from current document text = '.. csv-table::\n :file: example.csv\n' doctree = restructuredtext.parse(app, text, docname='subdir/index') @@ -62,8 +67,12 @@ def test_csv_table_directive(app): ], ), ) + table = _as_element(doctree[0]) + tgroup = _as_element(table[0]) + tbody = _as_element(tgroup[3]) + first_row = _as_element(tbody[0]) assert_node( - doctree[0][0][3][0], + first_row, ( [nodes.entry, nodes.paragraph, 'FOO'], [nodes.entry, nodes.paragraph, 'BAR'], @@ -84,8 +93,12 @@ def test_csv_table_directive(app): ], ), ) + table = _as_element(doctree[0]) + tgroup = _as_element(table[0]) + tbody = _as_element(tgroup[3]) + first_row = _as_element(tbody[0]) assert_node( - doctree[0][0][3][0], + first_row, ( [nodes.entry, nodes.paragraph, 'foo'], [nodes.entry, nodes.paragraph, 'bar'],