Skip to content

Commit 68d5610

Browse files
Tests: update LaTeX label test expectations from Docutils r10151 (#13610)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
1 parent 55092e7 commit 68d5610

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/test_builders/test_build_latex.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from subprocess import CalledProcessError
1313
from typing import TYPE_CHECKING
1414

15+
import docutils
1516
import pygments
1617
import pytest
1718

@@ -1959,10 +1960,16 @@ def test_latex_labels(app: SphinxTestApp) -> None:
19591960

19601961
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
19611962

1963+
# ref: docutils r10151
1964+
if docutils.__version_info__[:2] < (0, 22):
1965+
figure_id, table_id = 'id1', 'id2'
1966+
else:
1967+
figure_id, table_id = 'id2', 'id3'
1968+
19621969
# figures
19631970
assert (
19641971
r'\caption{labeled figure}'
1965-
r'\label{\detokenize{index:id1}}'
1972+
r'\label{\detokenize{index:' + figure_id + '}}'
19661973
r'\label{\detokenize{index:figure2}}'
19671974
r'\label{\detokenize{index:figure1}}'
19681975
r'\end{figure}'
@@ -1988,7 +1995,7 @@ def test_latex_labels(app: SphinxTestApp) -> None:
19881995
# tables
19891996
assert (
19901997
r'\sphinxcaption{table caption}'
1991-
r'\label{\detokenize{index:id2}}'
1998+
r'\label{\detokenize{index:' + table_id + '}}'
19921999
r'\label{\detokenize{index:table2}}'
19932000
r'\label{\detokenize{index:table1}}'
19942001
) in result

0 commit comments

Comments
 (0)