22
33from __future__ import annotations
44
5+ from typing import TYPE_CHECKING
6+
57import pytest
68from docutils import nodes
79
810from sphinx .testing .util import assert_node
911from sphinx .util .docutils import patch_docutils
1012
13+ if TYPE_CHECKING :
14+ from sphinx .application import Sphinx
15+
1116
1217@pytest .mark .sphinx (
1318 'dummy' ,
1419 testroot = 'docutilsconf' ,
1520 freshenv = True ,
1621)
17- def test_html_with_default_docutilsconf (app ) :
22+ def test_html_with_default_docutilsconf (app : Sphinx ) -> None :
1823 with patch_docutils (app .confdir ):
1924 app .build ()
2025
2126 doctree = app .env .get_doctree ('index' )
27+ section = doctree [0 ]
28+ assert isinstance (section , nodes .Element )
2229 assert_node (
23- doctree [ 0 ] [1 ], [nodes .paragraph , ('Sphinx ' , [nodes .footnote_reference , '1' ])]
30+ section [1 ], [nodes .paragraph , ('Sphinx ' , [nodes .footnote_reference , '1' ])]
2431 )
2532
2633
@@ -31,11 +38,13 @@ def test_html_with_default_docutilsconf(app):
3138 docutils_conf = '[restructuredtext parser]\n trim_footnote_reference_space: true\n ' ,
3239 copy_test_root = True ,
3340)
34- def test_html_with_docutilsconf (app ) :
41+ def test_html_with_docutilsconf (app : Sphinx ) -> None :
3542 with patch_docutils (app .confdir ):
3643 app .build ()
3744
3845 doctree = app .env .get_doctree ('index' )
46+ section = doctree [0 ]
47+ assert isinstance (section , nodes .Element )
3948 assert_node (
40- doctree [ 0 ] [1 ], [nodes .paragraph , ('Sphinx' , [nodes .footnote_reference , '1' ])]
49+ section [1 ], [nodes .paragraph , ('Sphinx' , [nodes .footnote_reference , '1' ])]
4150 )
0 commit comments