Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ module = [
# tests/test_builders
"tests.test_builders.test_build",
"tests.test_builders.test_build_html",
"tests.test_builders.test_build_html_5_output",
"tests.test_builders.test_build_linkcheck",
# tests/test_directives
"tests.test_directives.test_directive_code",
Expand Down
21 changes: 17 additions & 4 deletions tests/test_builders/test_build_html_5_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@

if TYPE_CHECKING:
from collections.abc import Callable, Iterable
from pathlib import Path
from typing import Literal
from xml.etree.ElementTree import Element
from xml.etree.ElementTree import Element, ElementTree

from sphinx.testing.util import SphinxTestApp

Expand Down Expand Up @@ -523,19 +524,31 @@ def checker(nodes: Iterable[Element]) -> Literal[True]:
tags=['testtag'],
confoverrides={'html_context.hckey_co': 'hcval_co'},
)
def test_html5_output(app, cached_etree_parse, fname, path, check):
def test_html5_output(
app: SphinxTestApp,
cached_etree_parse: Callable[[Path], ElementTree],
fname: str,
path: str,
check: str,
) -> None:
app.build()
check_xpath(cached_etree_parse(app.outdir / fname), fname, path, check)


@pytest.mark.sphinx('html', testroot='markup-rubric')
def test_html5_rubric(app: SphinxTestApp) -> None:
def insert_invalid_rubric_heading_level(app, doctree, docname):
def insert_invalid_rubric_heading_level(
app: SphinxTestApp,
doctree: nodes.document,
docname: str,
) -> None:
if docname != 'index':
return
new_node = nodes.rubric('', 'INSERTED RUBRIC')
new_node['heading-level'] = 7
doctree[0].append(new_node)
section = doctree[0]
assert isinstance(section, nodes.Element)
section.append(new_node)

app.connect('doctree-resolved', insert_invalid_rubric_heading_level)
app.build()
Expand Down
Loading