|
11 | 11 | from tests.test_builders.xpath_util import check_xpath |
12 | 12 |
|
13 | 13 | if TYPE_CHECKING: |
| 14 | + from collections.abc import Callable |
| 15 | + from pathlib import Path |
| 16 | + from xml.etree.ElementTree import ElementTree |
| 17 | + |
14 | 18 | from sphinx.testing.util import SphinxTestApp |
15 | 19 |
|
16 | 20 |
|
@@ -73,7 +77,14 @@ def test_numfig_disabled_warn(app: SphinxTestApp) -> None: |
73 | 77 | ) |
74 | 78 | @pytest.mark.sphinx('html', testroot='numfig') |
75 | 79 | @pytest.mark.test_params(shared_result='test_build_html_numfig') |
76 | | -def test_numfig_disabled(app, cached_etree_parse, fname, path, check, be_found): |
| 80 | +def test_numfig_disabled( |
| 81 | + app: SphinxTestApp, |
| 82 | + cached_etree_parse: Callable[[Path], ElementTree], |
| 83 | + fname: str, |
| 84 | + path: str, |
| 85 | + check: str | None, |
| 86 | + be_found: bool, |
| 87 | +) -> None: |
77 | 88 | app.build() |
78 | 89 | check_xpath(cached_etree_parse(app.outdir / fname), fname, path, check, be_found) |
79 | 90 |
|
@@ -305,8 +316,13 @@ def test_numfig_without_numbered_toctree_warn(app: SphinxTestApp) -> None: |
305 | 316 | confoverrides={'numfig': True}, |
306 | 317 | ) |
307 | 318 | def test_numfig_without_numbered_toctree( |
308 | | - app, cached_etree_parse, fname, path, check, be_found |
309 | | -): |
| 319 | + app: SphinxTestApp, |
| 320 | + cached_etree_parse: Callable[[Path], ElementTree], |
| 321 | + fname: str, |
| 322 | + path: str, |
| 323 | + check: str | None, |
| 324 | + be_found: bool, |
| 325 | +) -> None: |
310 | 326 | # remove :numbered: option |
311 | 327 | index = (app.srcdir / 'index.rst').read_text(encoding='utf8') |
312 | 328 | index = re.sub(':numbered:.*', '', index) |
@@ -538,8 +554,13 @@ def test_numfig_with_numbered_toctree_warn(app: SphinxTestApp) -> None: |
538 | 554 | ) |
539 | 555 | @pytest.mark.test_params(shared_result='test_build_html_numfig_on') |
540 | 556 | def test_numfig_with_numbered_toctree( |
541 | | - app, cached_etree_parse, fname, path, check, be_found |
542 | | -): |
| 557 | + app: SphinxTestApp, |
| 558 | + cached_etree_parse: Callable[[Path], ElementTree], |
| 559 | + fname: str, |
| 560 | + path: str, |
| 561 | + check: str | None, |
| 562 | + be_found: bool, |
| 563 | +) -> None: |
543 | 564 | app.build() |
544 | 565 | check_xpath(cached_etree_parse(app.outdir / fname), fname, path, check, be_found) |
545 | 566 |
|
@@ -780,7 +801,14 @@ def test_numfig_with_prefix_warn(app: SphinxTestApp) -> None: |
780 | 801 | }, |
781 | 802 | ) |
782 | 803 | @pytest.mark.test_params(shared_result='test_build_html_numfig_format_warn') |
783 | | -def test_numfig_with_prefix(app, cached_etree_parse, fname, path, check, be_found): |
| 804 | +def test_numfig_with_prefix( |
| 805 | + app: SphinxTestApp, |
| 806 | + cached_etree_parse: Callable[[Path], ElementTree], |
| 807 | + fname: str, |
| 808 | + path: str, |
| 809 | + check: str | None, |
| 810 | + be_found: bool, |
| 811 | +) -> None: |
784 | 812 | app.build() |
785 | 813 | check_xpath(cached_etree_parse(app.outdir / fname), fname, path, check, be_found) |
786 | 814 |
|
@@ -1006,8 +1034,13 @@ def test_numfig_with_secnum_depth_warn(app: SphinxTestApp) -> None: |
1006 | 1034 | ) |
1007 | 1035 | @pytest.mark.test_params(shared_result='test_build_html_numfig_depth_2') |
1008 | 1036 | def test_numfig_with_secnum_depth( |
1009 | | - app, cached_etree_parse, fname, path, check, be_found |
1010 | | -): |
| 1037 | + app: SphinxTestApp, |
| 1038 | + cached_etree_parse: Callable[[Path], ElementTree], |
| 1039 | + fname: str, |
| 1040 | + path: str, |
| 1041 | + check: str | None, |
| 1042 | + be_found: bool, |
| 1043 | +) -> None: |
1011 | 1044 | app.build() |
1012 | 1045 | check_xpath(cached_etree_parse(app.outdir / fname), fname, path, check, be_found) |
1013 | 1046 |
|
@@ -1103,6 +1136,10 @@ def test_numfig_with_secnum_depth( |
1103 | 1136 | confoverrides={'numfig': True}, |
1104 | 1137 | ) |
1105 | 1138 | @pytest.mark.test_params(shared_result='test_build_html_numfig_on') |
1106 | | -def test_numfig_with_singlehtml(app, cached_etree_parse, expect): |
| 1139 | +def test_numfig_with_singlehtml( |
| 1140 | + app: SphinxTestApp, |
| 1141 | + cached_etree_parse: Callable[[Path], ElementTree], |
| 1142 | + expect: tuple[str, str, bool], |
| 1143 | +) -> None: |
1107 | 1144 | app.build() |
1108 | 1145 | check_xpath(cached_etree_parse(app.outdir / 'index.html'), 'index.html', *expect) |
0 commit comments