Skip to content

Commit

Permalink
Fix 'test_html_scaled_image_link' for Docutils' HEAD (#11863)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Turner <[email protected]>
  • Loading branch information
jayaddison and AA-Turner authored Jan 10, 2024
1 parent 6083351 commit 3b5d2af
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_build_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pathlib import Path
from unittest.mock import ANY, call, patch

import docutils
import pytest
from html5lib import HTMLParser

Expand Down Expand Up @@ -1645,8 +1646,11 @@ def test_html_scaled_image_link(app):
assert re.search('\n<img alt="_images/img.png" src="_images/img.png" />', context)

# scaled_image_link
# Docutils 0.21 adds a newline before the closing </a> tag
closing_space = "\n" if docutils.__version_info__[:2] >= (0, 21) else ""
assert re.search('\n<a class="reference internal image-reference" href="_images/img.png">'
'<img alt="_images/img.png" src="_images/img.png" style="[^"]+" /></a>',
'<img alt="_images/img.png" src="_images/img.png" style="[^"]+" />'
f'{closing_space}</a>',
context)

# no-scaled-link class disables the feature
Expand Down

0 comments on commit 3b5d2af

Please sign in to comment.