Skip to content

Commit f3a1c3e

Browse files
committed
fix(mypy): Restore t.cast for MockTranslator in test_nodes.py
why: just watch-mypy uses find to include all .py files, bypassing pyproject.toml's exclude setting for tests/docs/. what: - Restore TYPE_CHECKING import for HTML5Translator - Restore t.cast calls for MockTranslator arguments
1 parent 426300d commit f3a1c3e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/docs/_ext/sphinx_argparse_neo/test_nodes.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import re
66
import typing as t
77

8+
if t.TYPE_CHECKING:
9+
from sphinx.writers.html5 import HTML5Translator
10+
811
import pytest
912
from docutils import nodes
1013
from sphinx_argparse_neo.nodes import (
@@ -469,8 +472,8 @@ def render_argument_to_html(
469472
node["id_prefix"] = id_prefix
470473

471474
translator = MockTranslator()
472-
visit_argparse_argument_html(translator, node)
473-
depart_argparse_argument_html(translator, node)
475+
visit_argparse_argument_html(t.cast("HTML5Translator", translator), node)
476+
depart_argparse_argument_html(t.cast("HTML5Translator", translator), node)
474477

475478
return "".join(translator.body)
476479

0 commit comments

Comments
 (0)