Page MenuHomeSoftware Heritage

D5434.diff
No OneTemporary

D5434.diff

diff --git a/swh/web/tests/common/test_utils.py b/swh/web/tests/common/test_utils.py
--- a/swh/web/tests/common/test_utils.py
+++ b/swh/web/tests/common/test_utils.py
@@ -6,6 +6,8 @@
import datetime
from urllib.parse import quote
+import docutils
+from pkg_resources import parse_version
import pytest
from django.conf.urls import url
@@ -122,24 +124,29 @@
"#. It has two items too.\n"
)
+ if parse_version(docutils.__version__) >= parse_version("0.17"):
+ (section_open, section_close) = ("section", "section")
+ else:
+ (section_open, section_close) = ('div class="section"', "div")
+
expected_html = (
- '<div class="swh-rst"><h1 class="title">Section</h1>\n'
- "<p><strong>Some strong text</strong></p>\n"
- '<div class="section" id="subsection">\n'
- "<h2>Subsection</h2>\n"
- '<ul class="simple">\n'
- "<li><p>This is a bulleted list.</p></li>\n"
- "<li><p>It has two items, the second\n"
- "item uses two lines.</p></li>\n"
- "</ul>\n"
- '<ol class="arabic simple">\n'
- "<li><p>This is a numbered list.</p></li>\n"
- "<li><p>It has two items too.</p></li>\n"
- "<li><p>This is a numbered list.</p></li>\n"
- "<li><p>It has two items too.</p></li>\n"
- "</ol>\n"
- "</div>\n"
- "</div>"
+ f'<div class="swh-rst"><h1 class="title">Section</h1>\n'
+ f"<p><strong>Some strong text</strong></p>\n"
+ f'<{section_open} id="subsection">\n'
+ f"<h2>Subsection</h2>\n"
+ f'<ul class="simple">\n'
+ f"<li><p>This is a bulleted list.</p></li>\n"
+ f"<li><p>It has two items, the second\n"
+ f"item uses two lines.</p></li>\n"
+ f"</ul>\n"
+ f'<ol class="arabic simple">\n'
+ f"<li><p>This is a numbered list.</p></li>\n"
+ f"<li><p>It has two items too.</p></li>\n"
+ f"<li><p>This is a numbered list.</p></li>\n"
+ f"<li><p>It has two items too.</p></li>\n"
+ f"</ol>\n"
+ f"</{section_close}>\n"
+ f"</div>"
)
assert utils.rst_to_html(rst) == expected_html

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 17, 10:29 PM (2 d, 8 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3214666

Event Timeline