Skip to content

Commit ded587e

Browse files
danieleadesdaniel.eades
andauthored
Shrink mypy whitelist for tests.test_directives.test_directive_patch (#14139)
Co-authored-by: daniel.eades <daniel.eades@seebyte.com>
1 parent a03556f commit ded587e

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ module = [
223223
"tests.test_config.test_config",
224224
# tests/test_directives
225225
"tests.test_directives.test_directive_other",
226-
"tests.test_directives.test_directive_patch",
227226
# tests/test_domains
228227
"tests.test_domains.test_domain_c",
229228
"tests.test_domains.test_domain_cpp",

tests/test_directives/test_directive_patch.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,13 @@ def test_code_directive(app: SphinxTestApp) -> None:
4747
)
4848

4949

50+
def _as_element(node: nodes.Node) -> nodes.Element:
51+
assert isinstance(node, nodes.Element)
52+
return node
53+
54+
5055
@pytest.mark.sphinx('html', testroot='directive-csv-table')
51-
def test_csv_table_directive(app):
56+
def test_csv_table_directive(app: SphinxTestApp) -> None:
5257
# relative path from current document
5358
text = '.. csv-table::\n :file: example.csv\n'
5459
doctree = restructuredtext.parse(app, text, docname='subdir/index')
@@ -62,8 +67,12 @@ def test_csv_table_directive(app):
6267
],
6368
),
6469
)
70+
table = _as_element(doctree[0])
71+
tgroup = _as_element(table[0])
72+
tbody = _as_element(tgroup[3])
73+
first_row = _as_element(tbody[0])
6574
assert_node(
66-
doctree[0][0][3][0],
75+
first_row,
6776
(
6877
[nodes.entry, nodes.paragraph, 'FOO'],
6978
[nodes.entry, nodes.paragraph, 'BAR'],
@@ -84,8 +93,12 @@ def test_csv_table_directive(app):
8493
],
8594
),
8695
)
96+
table = _as_element(doctree[0])
97+
tgroup = _as_element(table[0])
98+
tbody = _as_element(tgroup[3])
99+
first_row = _as_element(tbody[0])
87100
assert_node(
88-
doctree[0][0][3][0],
101+
first_row,
89102
(
90103
[nodes.entry, nodes.paragraph, 'foo'],
91104
[nodes.entry, nodes.paragraph, 'bar'],

0 commit comments

Comments
 (0)