|
12 | 12 |
|
13 | 13 | if TYPE_CHECKING: |
14 | 14 | from collections.abc import Callable, Iterable |
| 15 | + from pathlib import Path |
15 | 16 | from typing import Literal |
16 | | - from xml.etree.ElementTree import Element |
| 17 | + from xml.etree.ElementTree import Element, ElementTree |
17 | 18 |
|
18 | 19 | from sphinx.testing.util import SphinxTestApp |
19 | 20 |
|
@@ -523,19 +524,31 @@ def checker(nodes: Iterable[Element]) -> Literal[True]: |
523 | 524 | tags=['testtag'], |
524 | 525 | confoverrides={'html_context.hckey_co': 'hcval_co'}, |
525 | 526 | ) |
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: |
527 | 534 | app.build() |
528 | 535 | check_xpath(cached_etree_parse(app.outdir / fname), fname, path, check) |
529 | 536 |
|
530 | 537 |
|
531 | 538 | @pytest.mark.sphinx('html', testroot='markup-rubric') |
532 | 539 | 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: |
534 | 545 | if docname != 'index': |
535 | 546 | return |
536 | 547 | new_node = nodes.rubric('', 'INSERTED RUBRIC') |
537 | 548 | 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) |
539 | 552 |
|
540 | 553 | app.connect('doctree-resolved', insert_invalid_rubric_heading_level) |
541 | 554 | app.build() |
|
0 commit comments