1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
"""Test back references."""
from test.common import html_citations
import pytest
@pytest.mark.sphinx("html", testroot="backrefs")
def test_backrefs(app, warning) -> None:
app.build()
output = (app.outdir / "index.html").read_text()
match = html_citations(text=".*Test zero.*").search(output)
assert match
assert match.group("backref") is None
assert match.group("backref1") is None
assert match.group("backref2") is None
assert match.group("backref3") is None
match = html_citations(text=".*Test one.*").search(output)
assert match
assert match.group("backref") is not None
assert match.group("backref1") is None
assert match.group("backref2") is None
assert match.group("backref3") is None
match = html_citations(text=".*Test two.*").search(output)
assert match
assert match.group("backref") is None
assert match.group("backref1") is not None
assert match.group("backref2") is not None
assert match.group("backref3") is None
match = html_citations(text=".*Test three.*").search(output)
assert match
assert match.group("backref") is None
assert match.group("backref1") is not None
assert match.group("backref2") is not None
assert match.group("backref3") is not None
|