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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
From: James Addison <55152140+jayaddison@users.noreply.github.com>
Date: Mon, 2 Jun 2025 22:02:48 +0000
Subject: Tests: update LaTeX label test expectations from Docutils r10151
(#13610)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
(cherry picked from commit 68d56109ff50dd81dd31d4a01e3dccbd006c50ee)
---
tests/test_builders/test_build_latex.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/tests/test_builders/test_build_latex.py b/tests/test_builders/test_build_latex.py
index ea585cd..47c84e7 100644
--- a/tests/test_builders/test_build_latex.py
+++ b/tests/test_builders/test_build_latex.py
@@ -12,6 +12,7 @@ from shutil import copyfile
from subprocess import CalledProcessError
from typing import TYPE_CHECKING
+import docutils
import pygments
import pytest
@@ -1948,10 +1949,16 @@ def test_latex_labels(app: SphinxTestApp) -> None:
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
+ # ref: docutils r10151
+ if docutils.__version_info__[:2] < (0, 22):
+ figure_id, table_id = 'id1', 'id2'
+ else:
+ figure_id, table_id = 'id2', 'id3'
+
# figures
assert (
r'\caption{labeled figure}'
- r'\label{\detokenize{index:id1}}'
+ r'\label{\detokenize{index:' + figure_id + '}}'
r'\label{\detokenize{index:figure2}}'
r'\label{\detokenize{index:figure1}}'
r'\end{figure}'
@@ -1977,7 +1984,7 @@ def test_latex_labels(app: SphinxTestApp) -> None:
# tables
assert (
r'\sphinxcaption{table caption}'
- r'\label{\detokenize{index:id2}}'
+ r'\label{\detokenize{index:' + table_id + '}}'
r'\label{\detokenize{index:table2}}'
r'\label{\detokenize{index:table1}}'
) in result
|