tests.sphinx.test_sphinx_mermaid moduleΒΆ

Tests for the autoclasstree override that keeps d3 zoom off class diagrams.

tests.sphinx.test_sphinx_mermaid.DIAGRAM = 'Class diagram of orchard.Pear.'ΒΆ

Text the stand-in autoclasstree renders for each diagram.

class tests.sphinx.test_sphinx_mermaid.StubClassDiagram(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]ΒΆ

Bases: Directive

Stand-in for the autoclasstree directive of sphinxcontrib-mermaid.

required_arguments = 1ΒΆ

Number of required directive arguments.

run(**kwargs)[source]ΒΆ
Return type:

list[Node]

tests.sphinx.test_sphinx_mermaid.stub_setup(app)[source]ΒΆ

Register what the override reads of sphinxcontrib-mermaid.

Return type:

dict[str, bool]

tests.sphinx.test_sphinx_mermaid.mermaid_stub(monkeypatch)[source]ΒΆ

Serve a stand-in for sphinxcontrib-mermaid, which the test group lacks.

The stand-in only holds the directive and the config value the override reads.

Return type:

None

tests.sphinx.test_sphinx_mermaid.build(tmp_path, *, loaded, d3_zoom)[source]ΒΆ

Build a page, with an autoclasstree diagram when the stand-in is loaded.

click_extra.sphinx comes first in extensions, before the directive it overrides is registered. d3_zoom sets mermaid_d3_zoom, left to its default when None.

Return type:

tuple[str, bool]

Returns:

the HTML of the page, and whether autoclasstree is registered.

tests.sphinx.test_sphinx_mermaid.test_class_diagrams_skip_the_zoom(tmp_path, loaded, d3_zoom, overridden)[source]ΒΆ

The override wraps each diagram only with sphinxcontrib-mermaid and zoom on.

The page then links the stylesheet the wrapper hooks into. Otherwise the directive renders as sphinxcontrib-mermaid draws it, or not at all.

Return type:

None