Skip to content

Commit 19acb6f

Browse files
Remove mypy overrides for tests/test_builders/test_build_html_5_output.py (#14072)
1 parent edd2bd3 commit 19acb6f

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ module = [
224224
# tests/test_builders
225225
"tests.test_builders.test_build",
226226
"tests.test_builders.test_build_html",
227-
"tests.test_builders.test_build_html_5_output",
228227
"tests.test_builders.test_build_linkcheck",
229228
# tests/test_directives
230229
"tests.test_directives.test_directive_code",

tests/test_builders/test_build_html_5_output.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212

1313
if TYPE_CHECKING:
1414
from collections.abc import Callable, Iterable
15+
from pathlib import Path
1516
from typing import Literal
16-
from xml.etree.ElementTree import Element
17+
from xml.etree.ElementTree import Element, ElementTree
1718

1819
from sphinx.testing.util import SphinxTestApp
1920

@@ -523,19 +524,31 @@ def checker(nodes: Iterable[Element]) -> Literal[True]:
523524
tags=['testtag'],
524525
confoverrides={'html_context.hckey_co': 'hcval_co'},
525526
)
526-
def test_html5_output(app, cached_etree_parse, fname, path, check):
527+
def test_html5_output(
528+
app: SphinxTestApp,
529+
cached_etree_parse: Callable[[Path], ElementTree],
530+
fname: str,
531+
path: str,
532+
check: str,
533+
) -> None:
527534
app.build()
528535
check_xpath(cached_etree_parse(app.outdir / fname), fname, path, check)
529536

530537

531538
@pytest.mark.sphinx('html', testroot='markup-rubric')
532539
def test_html5_rubric(app: SphinxTestApp) -> None:
533-
def insert_invalid_rubric_heading_level(app, doctree, docname):
540+
def insert_invalid_rubric_heading_level(
541+
app: SphinxTestApp,
542+
doctree: nodes.document,
543+
docname: str,
544+
) -> None:
534545
if docname != 'index':
535546
return
536547
new_node = nodes.rubric('', 'INSERTED RUBRIC')
537548
new_node['heading-level'] = 7
538-
doctree[0].append(new_node)
549+
section = doctree[0]
550+
assert isinstance(section, nodes.Element)
551+
section.append(new_node)
539552

540553
app.connect('doctree-resolved', insert_invalid_rubric_heading_level)
541554
app.build()

0 commit comments

Comments
 (0)