https://github.com/sphinx-doc/sphinx/commit/71b1a06024268e39f59e3772e2420555cb9bf174
--- sphinx-7.4.7/tests/test_builders/test_build_html_image.py.orig
+++ sphinx-7.4.7/tests/test_builders/test_build_html_image.py
@@ -52,17 +52,32 @@
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.sphinx('html', testroot='images')