mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix tests for Docutils revision 9928 (#12897)
This commit is contained in:
parent
56716ed514
commit
71b1a06024
@ -61,21 +61,36 @@ 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="[^"]+" />'
|
||||
f'{closing_space}</a>',
|
||||
context,
|
||||
)
|
||||
if docutils.__version_info__[:2] >= (0, 22):
|
||||
assert re.search(
|
||||
'\n<a class="reference internal image-reference" href="_images/img.png">'
|
||||
'<img alt="_images/img.png" height="[^"]+" src="_images/img.png" width="[^"]+" />'
|
||||
'\n</a>',
|
||||
context,
|
||||
)
|
||||
else:
|
||||
# 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="[^"]+" />'
|
||||
f'{closing_space}</a>',
|
||||
context,
|
||||
)
|
||||
|
||||
# no-scaled-link class disables the feature
|
||||
assert re.search(
|
||||
'\n<img alt="_images/img.png" class="no-scaled-link"'
|
||||
' src="_images/img.png" style="[^"]+" />',
|
||||
context,
|
||||
)
|
||||
if docutils.__version_info__[:2] >= (0, 22):
|
||||
assert re.search(
|
||||
'\n<img alt="_images/img.png" class="no-scaled-link"'
|
||||
' height="[^"]+" src="_images/img.png" width="[^"]+" />',
|
||||
context,
|
||||
)
|
||||
else:
|
||||
assert re.search(
|
||||
'\n<img alt="_images/img.png" class="no-scaled-link"'
|
||||
' src="_images/img.png" style="[^"]+" />',
|
||||
context,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('_http_teapot')
|
||||
|
Loading…
Reference in New Issue
Block a user