mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Remove mypy overrides for two files in `tests/test_writers
` (#13315)
This commit is contained in:
parent
36e3f3250d
commit
0782273dec
@ -287,9 +287,7 @@ module = [
|
||||
"tests.test_util.test_util_matching",
|
||||
"tests.test_util.test_util_uri",
|
||||
# tests/test_writers
|
||||
"tests.test_writers.test_api_translator",
|
||||
"tests.test_writers.test_docutilsconf",
|
||||
"tests.test_writers.test_writer_latex",
|
||||
]
|
||||
disallow_untyped_defs = false
|
||||
|
||||
|
@ -3,12 +3,19 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Iterator
|
||||
from pathlib import Path
|
||||
|
||||
from sphinx.testing.util import SphinxTestApp
|
||||
|
||||
|
||||
@pytest.fixture(scope='module', autouse=True)
|
||||
def _setup_module(rootdir):
|
||||
def _setup_module(rootdir: Path) -> Iterator[None]:
|
||||
saved_path = sys.path.copy()
|
||||
sys.path.insert(0, str(rootdir / 'test-api-set-translator'))
|
||||
yield
|
||||
@ -16,7 +23,7 @@ def _setup_module(rootdir):
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
def test_html_translator(app):
|
||||
def test_html_translator(app: SphinxTestApp) -> None:
|
||||
# no set_translator()
|
||||
translator_class = app.builder.get_translator_class()
|
||||
assert translator_class
|
||||
@ -24,7 +31,7 @@ def test_html_translator(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='api-set-translator')
|
||||
def test_html_with_set_translator_for_html_(app):
|
||||
def test_html_with_set_translator_for_html_(app: SphinxTestApp) -> None:
|
||||
# use set_translator()
|
||||
translator_class = app.builder.get_translator_class()
|
||||
assert translator_class
|
||||
@ -32,63 +39,63 @@ def test_html_with_set_translator_for_html_(app):
|
||||
|
||||
|
||||
@pytest.mark.sphinx('singlehtml', testroot='api-set-translator')
|
||||
def test_singlehtml_set_translator_for_singlehtml(app):
|
||||
def test_singlehtml_set_translator_for_singlehtml(app: SphinxTestApp) -> None:
|
||||
translator_class = app.builder.get_translator_class()
|
||||
assert translator_class
|
||||
assert translator_class.__name__ == 'ConfSingleHTMLTranslator'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('pickle', testroot='api-set-translator')
|
||||
def test_pickle_set_translator_for_pickle(app):
|
||||
def test_pickle_set_translator_for_pickle(app: SphinxTestApp) -> None:
|
||||
translator_class = app.builder.get_translator_class()
|
||||
assert translator_class
|
||||
assert translator_class.__name__ == 'ConfPickleTranslator'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('json', testroot='api-set-translator')
|
||||
def test_json_set_translator_for_json(app):
|
||||
def test_json_set_translator_for_json(app: SphinxTestApp) -> None:
|
||||
translator_class = app.builder.get_translator_class()
|
||||
assert translator_class
|
||||
assert translator_class.__name__ == 'ConfJsonTranslator'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('latex', testroot='api-set-translator')
|
||||
def test_html_with_set_translator_for_latex(app):
|
||||
def test_html_with_set_translator_for_latex(app: SphinxTestApp) -> None:
|
||||
translator_class = app.builder.get_translator_class()
|
||||
assert translator_class
|
||||
assert translator_class.__name__ == 'ConfLaTeXTranslator'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('man', testroot='api-set-translator')
|
||||
def test_html_with_set_translator_for_man(app):
|
||||
def test_html_with_set_translator_for_man(app: SphinxTestApp) -> None:
|
||||
translator_class = app.builder.get_translator_class()
|
||||
assert translator_class
|
||||
assert translator_class.__name__ == 'ConfManualPageTranslator'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('texinfo', testroot='api-set-translator')
|
||||
def test_html_with_set_translator_for_texinfo(app):
|
||||
def test_html_with_set_translator_for_texinfo(app: SphinxTestApp) -> None:
|
||||
translator_class = app.builder.get_translator_class()
|
||||
assert translator_class
|
||||
assert translator_class.__name__ == 'ConfTexinfoTranslator'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('text', testroot='api-set-translator')
|
||||
def test_html_with_set_translator_for_text(app):
|
||||
def test_html_with_set_translator_for_text(app: SphinxTestApp) -> None:
|
||||
translator_class = app.builder.get_translator_class()
|
||||
assert translator_class
|
||||
assert translator_class.__name__ == 'ConfTextTranslator'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('xml', testroot='api-set-translator')
|
||||
def test_html_with_set_translator_for_xml(app):
|
||||
def test_html_with_set_translator_for_xml(app: SphinxTestApp) -> None:
|
||||
translator_class = app.builder.get_translator_class()
|
||||
assert translator_class
|
||||
assert translator_class.__name__ == 'ConfXMLTranslator'
|
||||
|
||||
|
||||
@pytest.mark.sphinx('pseudoxml', testroot='api-set-translator')
|
||||
def test_html_with_set_translator_for_pseudoxml(app):
|
||||
def test_html_with_set_translator_for_pseudoxml(app: SphinxTestApp) -> None:
|
||||
translator_class = app.builder.get_translator_class()
|
||||
assert translator_class
|
||||
assert translator_class.__name__ == 'ConfPseudoXMLTranslator'
|
||||
|
@ -7,7 +7,7 @@ import pytest
|
||||
from sphinx.writers.latex import rstdim_to_latexdim
|
||||
|
||||
|
||||
def test_rstdim_to_latexdim():
|
||||
def test_rstdim_to_latexdim() -> None:
|
||||
# Length units docutils supported
|
||||
# https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#length-units
|
||||
assert rstdim_to_latexdim('160em') == '160em'
|
||||
|
Loading…
Reference in New Issue
Block a user