33from __future__ import annotations
44
55from textwrap import dedent
6- from typing import TYPE_CHECKING , Any
6+ from typing import TYPE_CHECKING , Any , cast
77
88import pytest
99from docutils import frontend , nodes
2323if TYPE_CHECKING :
2424 from collections .abc import Iterable
2525
26- from docutils .nodes import document
26+ from docutils .nodes import Element , document
27+
28+ from sphinx .testing .util import SphinxTestApp
2729
2830
2931def _transform (doctree : nodes .document ) -> None :
@@ -225,16 +227,18 @@ def test_make_id(app, prefix, term, expected):
225227
226228
227229@pytest .mark .sphinx ('html' , testroot = 'root' )
228- def test_make_id_already_registered (app ) :
230+ def test_make_id_already_registered (app : SphinxTestApp ) -> None :
229231 document = create_new_document ()
230- document .ids ['term-Sphinx' ] = True # register "term-Sphinx" manually
232+ document .ids ['term-Sphinx' ] = cast (
233+ 'Element' , True
234+ ) # register "term-Sphinx" manually
231235 assert make_id (app .env , document , 'term' , 'Sphinx' ) == 'term-0'
232236
233237
234238@pytest .mark .sphinx ('html' , testroot = 'root' )
235- def test_make_id_sequential (app ) :
239+ def test_make_id_sequential (app : SphinxTestApp ) -> None :
236240 document = create_new_document ()
237- document .ids ['term-0' ] = True
241+ document .ids ['term-0' ] = cast ( 'Element' , True )
238242 assert make_id (app .env , document , 'term' ) == 'term-1'
239243
240244
@@ -249,7 +253,7 @@ def test_make_id_sequential(app):
249253 ('hello <world> <sphinx>' , (True , 'hello <world>' , 'sphinx' )),
250254 ],
251255)
252- def test_split_explicit_target (title , expected ) :
256+ def test_split_explicit_target (title : str , expected : tuple [ bool , str , str ]) -> None :
253257 assert split_explicit_title (title ) == expected
254258
255259
0 commit comments