|
2 | 2 |
|
3 | 3 | from __future__ import annotations
|
4 | 4 |
|
| 5 | +from typing import TYPE_CHECKING |
| 6 | + |
5 | 7 | import pytest
|
6 | 8 |
|
7 | 9 | from tests.test_builders.xpath_html_util import _intradocument_hyperlink_check
|
8 | 10 | from tests.test_builders.xpath_util import check_xpath
|
9 | 11 |
|
| 12 | +if TYPE_CHECKING: |
| 13 | + from collections.abc import Callable |
| 14 | + from pathlib import Path |
| 15 | + from xml.etree.ElementTree import ElementTree |
| 16 | + |
| 17 | + from sphinx.testing.util import SphinxTestApp |
| 18 | + |
10 | 19 |
|
11 | 20 | @pytest.mark.parametrize(
|
12 | 21 | ('fname', 'path', 'check', 'be_found'),
|
|
68 | 77 | )
|
69 | 78 | @pytest.mark.sphinx('html', testroot='tocdepth')
|
70 | 79 | @pytest.mark.test_params(shared_result='test_build_html_tocdepth')
|
71 |
| -def test_tocdepth(app, cached_etree_parse, fname, path, check, be_found): |
| 80 | +def test_tocdepth( |
| 81 | + app: SphinxTestApp, |
| 82 | + cached_etree_parse: Callable[[Path], ElementTree], |
| 83 | + fname: str, |
| 84 | + path: str, |
| 85 | + check: str, |
| 86 | + be_found: bool, |
| 87 | +) -> None: |
72 | 88 | app.build()
|
73 | 89 | # https://github.com/sphinx-doc/sphinx/issues/1251
|
74 | 90 | check_xpath(cached_etree_parse(app.outdir / fname), fname, path, check, be_found)
|
@@ -111,6 +127,10 @@ def test_tocdepth(app, cached_etree_parse, fname, path, check, be_found):
|
111 | 127 | )
|
112 | 128 | @pytest.mark.sphinx('singlehtml', testroot='tocdepth')
|
113 | 129 | @pytest.mark.test_params(shared_result='test_build_html_tocdepth')
|
114 |
| -def test_tocdepth_singlehtml(app, cached_etree_parse, expect): |
| 130 | +def test_tocdepth_singlehtml( |
| 131 | + app: SphinxTestApp, |
| 132 | + cached_etree_parse: Callable[[Path], ElementTree], |
| 133 | + expect: tuple[str, str, bool], |
| 134 | +) -> None: |
115 | 135 | app.build()
|
116 | 136 | check_xpath(cached_etree_parse(app.outdir / 'index.html'), 'index.html', *expect)
|
0 commit comments