From ec468f90bdbdd4f3bf3208528a024ff8d283205a Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Mon, 17 Nov 2025 23:13:08 +0000 Subject: [PATCH] Remove mypy overrides for tests/test_writers/test_docutilsconf.py --- pyproject.toml | 2 -- tests/test_writers/test_docutilsconf.py | 17 +++++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e3418ab98a2..5a4f83e03f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -246,8 +246,6 @@ module = [ "tests.test_theming.test_theming", # tests/test_transforms "tests.test_transforms.test_transforms_post_transforms_images", - # tests/test_writers - "tests.test_writers.test_docutilsconf", ] disallow_untyped_defs = false diff --git a/tests/test_writers/test_docutilsconf.py b/tests/test_writers/test_docutilsconf.py index 32e9d13343c..1d321bdcbc8 100644 --- a/tests/test_writers/test_docutilsconf.py +++ b/tests/test_writers/test_docutilsconf.py @@ -2,25 +2,32 @@ from __future__ import annotations +from typing import TYPE_CHECKING + import pytest from docutils import nodes from sphinx.testing.util import assert_node from sphinx.util.docutils import patch_docutils +if TYPE_CHECKING: + from sphinx.application import Sphinx + @pytest.mark.sphinx( 'dummy', testroot='docutilsconf', freshenv=True, ) -def test_html_with_default_docutilsconf(app): +def test_html_with_default_docutilsconf(app: Sphinx) -> None: with patch_docutils(app.confdir): app.build() doctree = app.env.get_doctree('index') + section = doctree[0] + assert isinstance(section, nodes.Element) assert_node( - doctree[0][1], [nodes.paragraph, ('Sphinx ', [nodes.footnote_reference, '1'])] + section[1], [nodes.paragraph, ('Sphinx ', [nodes.footnote_reference, '1'])] ) @@ -31,11 +38,13 @@ def test_html_with_default_docutilsconf(app): docutils_conf='[restructuredtext parser]\ntrim_footnote_reference_space: true\n', copy_test_root=True, ) -def test_html_with_docutilsconf(app): +def test_html_with_docutilsconf(app: Sphinx) -> None: with patch_docutils(app.confdir): app.build() doctree = app.env.get_doctree('index') + section = doctree[0] + assert isinstance(section, nodes.Element) assert_node( - doctree[0][1], [nodes.paragraph, ('Sphinx', [nodes.footnote_reference, '1'])] + section[1], [nodes.paragraph, ('Sphinx', [nodes.footnote_reference, '1'])] )