From 71b1a06024268e39f59e3772e2420555cb9bf174 Mon Sep 17 00:00:00 2001
From: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Date: Wed, 18 Sep 2024 02:10:10 +0100
Subject: [PATCH] Fix tests for Docutils revision 9928 (#12897)
---
tests/test_builders/test_build_html_image.py | 41 +++++++++++++-------
1 file changed, 28 insertions(+), 13 deletions(-)
diff --git a/tests/test_builders/test_build_html_image.py b/tests/test_builders/test_build_html_image.py
index 6472a97504d..5a061ed4dec 100644
--- a/tests/test_builders/test_build_html_image.py
+++ b/tests/test_builders/test_build_html_image.py
@@ -61,21 +61,36 @@ def test_html_scaled_image_link(app):
assert re.search('\n', context)
# scaled_image_link
- # Docutils 0.21 adds a newline before the closing tag
- closing_space = '\n' if docutils.__version_info__[:2] >= (0, 21) else ''
- assert re.search(
- '\n'
- ''
- f'{closing_space}',
- context,
- )
+ if docutils.__version_info__[:2] >= (0, 22):
+ assert re.search(
+ '\n'
+ ''
+ '\n',
+ context,
+ )
+ else:
+ # Docutils 0.21 adds a newline before the closing tag
+ closing_space = '\n' if docutils.__version_info__[:2] >= (0, 21) else ''
+ assert re.search(
+ '\n'
+ ''
+ f'{closing_space}',
+ context,
+ )
# no-scaled-link class disables the feature
- assert re.search(
- '\n',
- context,
- )
+ if docutils.__version_info__[:2] >= (0, 22):
+ assert re.search(
+ '\n',
+ context,
+ )
+ else:
+ assert re.search(
+ '\n',
+ context,
+ )
@pytest.mark.usefixtures('_http_teapot')