Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/common/test_utils.py
Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | def test_gen_path_info(): | ||||
assert path_info == expected_result | assert path_info == expected_result | ||||
def test_rst_to_html(): | def test_rst_to_html(): | ||||
rst = ( | rst = ( | ||||
"Section\n" | "Section\n" | ||||
"=======\n\n" | "=======\n\n" | ||||
"**Some strong text**\n\n" | "**Some strong text**\n\n" | ||||
"Subsection\n" | |||||
"----------\n\n" | |||||
"* This is a bulleted list.\n" | "* This is a bulleted list.\n" | ||||
"* It has two items, the second\n" | "* It has two items, the second\n" | ||||
" item uses two lines.\n" | " item uses two lines.\n" | ||||
"\n" | "\n" | ||||
"1. This is a numbered list.\n" | "1. This is a numbered list.\n" | ||||
"2. It has two items too.\n" | "2. It has two items too.\n" | ||||
"\n" | "\n" | ||||
"#. This is a numbered list.\n" | "#. This is a numbered list.\n" | ||||
"#. It has two items too.\n" | "#. It has two items too.\n" | ||||
) | ) | ||||
expected_html = ( | expected_html = ( | ||||
'<div class="swh-rst"><h1 class="title">Section</h1>\n' | '<div class="swh-rst"><h1 class="title">Section</h1>\n' | ||||
"<p><strong>Some strong text</strong></p>\n" | "<p><strong>Some strong text</strong></p>\n" | ||||
'<div class="section" id="subsection">\n' | |||||
"<h2>Subsection</h2>\n" | |||||
'<ul class="simple">\n' | '<ul class="simple">\n' | ||||
"<li><p>This is a bulleted list.</p></li>\n" | "<li><p>This is a bulleted list.</p></li>\n" | ||||
"<li><p>It has two items, the second\n" | "<li><p>It has two items, the second\n" | ||||
"item uses two lines.</p></li>\n" | "item uses two lines.</p></li>\n" | ||||
"</ul>\n" | "</ul>\n" | ||||
'<ol class="arabic simple">\n' | '<ol class="arabic simple">\n' | ||||
"<li><p>This is a numbered list.</p></li>\n" | "<li><p>This is a numbered list.</p></li>\n" | ||||
"<li><p>It has two items too.</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>This is a numbered list.</p></li>\n" | ||||
"<li><p>It has two items too.</p></li>\n" | "<li><p>It has two items too.</p></li>\n" | ||||
"</ol>\n" | "</ol>\n" | ||||
"</div>\n" | |||||
"</div>" | "</div>" | ||||
) | ) | ||||
assert utils.rst_to_html(rst) == expected_html | assert utils.rst_to_html(rst) == expected_html | ||||
def sample_test_view(request, string, number): | def sample_test_view(request, string, number): | ||||
pass | pass | ||||
▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines |