Remove mypy overrides for `tests.test_builders.test_build_text` (#13341)

This commit is contained in:
Adam Dangoor 2025-02-15 20:16:34 +00:00 committed by GitHub
parent 3f2b211fb7
commit 89797c728a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 16 deletions

View File

@ -217,7 +217,6 @@ module = [
"tests.test_builders.test_build_html_toctree",
"tests.test_builders.test_build_linkcheck",
"tests.test_builders.test_build_manpage",
"tests.test_builders.test_build_text",
"tests.test_builders.test_build_warnings",
"tests.test_builders.test_incremental_reading",
# tests/test_directives

View File

@ -12,13 +12,15 @@ from sphinx.writers.text import MAXWIDTH, Cell, Table
if TYPE_CHECKING:
from typing import Any
from sphinx.testing.util import SphinxTestApp
def with_text_app(*args: Any, **kw: Any) -> pytest.MarkDecorator:
return pytest.mark.sphinx(*args, buildername='text', testroot='build-text', **kw)
@with_text_app()
def test_maxwitdh_with_prefix(app):
def test_maxwitdh_with_prefix(app: SphinxTestApp) -> None:
app.build()
result = (app.outdir / 'maxwidth.txt').read_text(encoding='utf8')
@ -40,7 +42,7 @@ def test_maxwitdh_with_prefix(app):
@with_text_app()
def test_lineblock(app):
def test_lineblock(app: SphinxTestApp) -> None:
# regression test for #1109: need empty line after line block
app.build()
result = (app.outdir / 'lineblock.txt').read_text(encoding='utf8')
@ -49,7 +51,7 @@ def test_lineblock(app):
@with_text_app()
def test_nonascii_title_line(app):
def test_nonascii_title_line(app: SphinxTestApp) -> None:
app.build(force_all=True)
result = (app.outdir / 'nonascii_title.txt').read_text(encoding='utf8')
expect_underline = '*********'
@ -58,7 +60,7 @@ def test_nonascii_title_line(app):
@with_text_app()
def test_nonascii_table(app):
def test_nonascii_table(app: SphinxTestApp) -> None:
app.build()
result = (app.outdir / 'nonascii_table.txt').read_text(encoding='utf8')
lines = [line.strip() for line in result.splitlines() if line.strip()]
@ -67,7 +69,7 @@ def test_nonascii_table(app):
@with_text_app()
def test_nonascii_maxwidth(app):
def test_nonascii_maxwidth(app: SphinxTestApp) -> None:
app.build()
result = (app.outdir / 'nonascii_maxwidth.txt').read_text(encoding='utf8')
lines = [line.strip() for line in result.splitlines() if line.strip()]
@ -75,7 +77,7 @@ def test_nonascii_maxwidth(app):
assert max(line_widths) < MAXWIDTH
def test_table_builder():
def test_table_builder() -> None:
table = Table([6, 6])
table.add_cell(Cell('foo'))
table.add_cell(Cell('bar'))
@ -86,7 +88,7 @@ def test_table_builder():
assert repr(table).count('<Cell ') == 2
def test_table_separator():
def test_table_separator() -> None:
table = Table([6, 6])
table.add_cell(Cell('foo'))
table.add_cell(Cell('bar'))
@ -103,7 +105,7 @@ def test_table_separator():
assert repr(table).count('<Cell ') == 4
def test_table_cell():
def test_table_cell() -> None:
cell = Cell('Foo bar baz')
cell.wrap(3)
assert 'Cell' in repr(cell)
@ -111,7 +113,7 @@ def test_table_cell():
@with_text_app()
def test_table_with_empty_cell(app):
def test_table_with_empty_cell(app: SphinxTestApp) -> None:
app.build()
result = (app.outdir / 'table.txt').read_text(encoding='utf8')
lines = [line.strip() for line in result.splitlines() if line.strip()]
@ -125,7 +127,7 @@ def test_table_with_empty_cell(app):
@with_text_app()
def test_table_with_rowspan(app):
def test_table_with_rowspan(app: SphinxTestApp) -> None:
app.build()
result = (app.outdir / 'table_rowspan.txt').read_text(encoding='utf8')
lines = [line.strip() for line in result.splitlines() if line.strip()]
@ -139,7 +141,7 @@ def test_table_with_rowspan(app):
@with_text_app()
def test_table_with_colspan(app):
def test_table_with_colspan(app: SphinxTestApp) -> None:
app.build()
result = (app.outdir / 'table_colspan.txt').read_text(encoding='utf8')
lines = [line.strip() for line in result.splitlines() if line.strip()]
@ -153,7 +155,7 @@ def test_table_with_colspan(app):
@with_text_app()
def test_table_with_colspan_left(app):
def test_table_with_colspan_left(app: SphinxTestApp) -> None:
app.build()
result = (app.outdir / 'table_colspan_left.txt').read_text(encoding='utf8')
lines = [line.strip() for line in result.splitlines() if line.strip()]
@ -167,7 +169,7 @@ def test_table_with_colspan_left(app):
@with_text_app()
def test_table_with_colspan_and_rowspan(app):
def test_table_with_colspan_and_rowspan(app: SphinxTestApp) -> None:
app.build()
result = (app.outdir / 'table_colspan_and_rowspan.txt').read_text(encoding='utf8')
lines = [line.strip() for line in result.splitlines() if line.strip()]
@ -182,7 +184,7 @@ def test_table_with_colspan_and_rowspan(app):
@with_text_app()
def test_list_items_in_admonition(app):
def test_list_items_in_admonition(app: SphinxTestApp) -> None:
app.build()
result = (app.outdir / 'listitems.txt').read_text(encoding='utf8')
lines = [line.rstrip() for line in result.splitlines()]
@ -194,7 +196,7 @@ def test_list_items_in_admonition(app):
@with_text_app()
def test_secnums(app):
def test_secnums(app: SphinxTestApp) -> None:
app.build(force_all=True)
index = (app.outdir / 'index.txt').read_text(encoding='utf8')
lines = index.splitlines()