本文整理汇总了Python中pydocx.tests.assert_html_equal函数的典型用法代码示例。如果您正苦于以下问题:Python assert_html_equal函数的具体用法?Python assert_html_equal怎么用?Python assert_html_equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_html_equal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_nested_tables
def test_nested_tables():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'nested_tables.docx',
)
actual_html = convert(file_path)
# Find out why br tag is there.
assert_html_equal(actual_html, BASE_HTML % '''
<table border="1">
<tr>
<td>AAA</td>
<td>BBB</td>
</tr>
<tr>
<td>CCC</td>
<td>
<table border="1">
<tr>
<td>DDD</td>
<td>EEE</td>
</tr>
<tr>
<td>FFF</td>
<td>GGG</td>
</tr>
</table>
</td>
</tr>
</table>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:32,代码来源:test_docx.py
示例2: test_convert_p_to_h
def test_convert_p_to_h():
raise SkipTest('This test is not yet passing')
# Show when it is correct to convert a p tag to an h tag based on
# bold/italics
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'convert_p_to_h.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<h2>AAA</h2>
<h2>BBB</h2>
<p>CCC</p>
<ol list-style-type="decimal">
<li><strong>DDD</strong></li>
<li><em>EEE</em></li>
<li>FFF</li>
</ol>
<table border="1">
<tr>
<td><strong>GGG</strong></td>
<td><em>HHH</em></td>
</tr>
<tr>
<td>III</td>
<td>JJJ</td>
</tr>
</table>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:31,代码来源:test_docx.py
示例3: test_shift_enter
def test_shift_enter():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'shift_enter.docx',
)
# Test just the convert without clean_html to make sure the first
# break tag is present.
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<p>AAA<br />BBB</p>
<p>CCC</p>
<ol list-style-type="decimal">
<li>DDD<br />EEE</li>
<li>FFF</li>
</ol>
<table border="1">
<tr>
<td>GGG<br />HHH</td>
<td>III<br />JJJ</td>
</tr>
<tr>
<td>KKK</td>
<td>LLL</td>
</tr>
</table>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:29,代码来源:test_docx.py
示例4: test_list_to_header
def test_list_to_header():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'list_to_header.docx',
)
actual_html = convert(file_path, convert_root_level_upper_roman=True)
# It should be noted that list item `GGG` is upper roman in the word
# document to show that only top level upper romans get converted.
assert_html_equal(actual_html, BASE_HTML % '''
<h2>AAA</h2>
<ol list-style-type="decimal">
<li>BBB</li>
</ol>
<h2>CCC</h2>
<ol list-style-type="decimal">
<li>DDD</li>
</ol>
<h2>EEE</h2>
<ol list-style-type="decimal">
<li>FFF
<ol list-style-type="upperRoman">
<li>GGG</li>
</ol>
</li>
</ol>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:28,代码来源:test_docx.py
示例5: test_lists_with_styles
def test_lists_with_styles():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'lists_with_styles.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<ol list-style-type="decimal">
<li>AAA</li>
<li>BBB
<ol list-style-type="lowerRoman">
<li>CCC</li>
<li>DDD
<ol list-style-type="upperLetter">
<li>EEE
<ol list-style-type="lowerLetter">
<li>FFF</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:27,代码来源:test_docx.py
示例6: test_justification
def test_justification():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'justification.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<p>
<div class='pydocx-center'>Center Justified</div>
</p>
<p>
<div class='pydocx-right'>Right justified</div>
</p>
<p>
<div class='pydocx-right' style='margin-right:96.0px;'>
Right justified and pushed in from right
</div>
</p>
<p>
<div class='pydocx-center'
style='margin-left:252.0px;margin-right:96.0px;'>
Center justified and pushed in from left and it is
great and it is the coolest thing of all time and I like it and
I think it is cool
</div>
</p>
<p>
<div style='margin-left:252.0px;margin-right:96.0px;'>
Left justified and pushed in from left
</div>
</p>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:34,代码来源:test_docx.py
示例7: test_tables_in_lists
def test_tables_in_lists():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'tables_in_lists.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<ol list-style-type="decimal">
<li>AAA</li>
<li>BBB
<table border="1">
<tr>
<td>CCC</td>
<td>DDD</td>
</tr>
<tr>
<td>EEE</td>
<td>FFF</td>
</tr>
</table>
</li>
<li>GGG</li>
</ol>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:26,代码来源:test_docx.py
示例8: test_extract_html
def test_extract_html():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'simple.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<p>
Simple text
</p>
<ol list-style-type="decimal">
<li>one</li>
<li>two</li>
<li>three</li>
</ol>
<table border="1">
<tr>
<td>Cell1</td>
<td>Cell2</td>
</tr>
<tr>
<td>Cell3</td>
<td>Cell4</td>
</tr>
</table>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:28,代码来源:test_docx.py
示例9: test_nested_table_rowspan
def test_nested_table_rowspan():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'nested_table_rowspan.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<table border="1">
<tr>
<td colspan="2">AAA</td>
</tr>
<tr>
<td>BBB</td>
<td>
<table border="1">
<tr>
<td rowspan="2">CCC</td>
<td>DDD</td>
</tr>
<tr>
<td>EEE</td>
</tr>
</table>
</td>
</tr>
</table>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:29,代码来源:test_docx.py
示例10: test_include_tabs
def test_include_tabs():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'include_tabs.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '<p>AAA BBB</p>')
开发者ID:Isendir,项目名称:pydocx,代码行数:9,代码来源:test_docx.py
示例11: test_table_col_row_span
def test_table_col_row_span():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'table_col_row_span.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<table border="1">
<tr>
<td colspan="2">AAA</td>
</tr>
<tr>
<td rowspan="2">BBB</td>
<td>CCC</td>
</tr>
<tr>
<td>DDD</td>
</tr>
<tr>
<td>
<div class='pydocx-right'>EEE
</div></td>
<td rowspan="2">FFF</td>
</tr>
<tr>
<td>
<div class='pydocx-right'>GGG
</div></td>
</tr>
</table>
<table border="1">
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>5</td>
<td colspan="2" rowspan="2">6</td>
<td>7</td>
</tr>
<tr>
<td>8</td>
<td>9</td>
</tr>
<tr>
<td>10</td>
<td>11</td>
<td>12</td>
<td>13</td>
</tr>
</table>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:56,代码来源:test_docx.py
示例12: test_special_chars
def test_special_chars():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'special_chars.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<p>& < > <a href="https://www.google.com/?test=1&more=2">link</a></p>''') # noqa
开发者ID:Isendir,项目名称:pydocx,代码行数:10,代码来源:test_docx.py
示例13: test_track_changes_on
def test_track_changes_on():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'track_changes_on.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<p>This was some content.</p>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:11,代码来源:test_docx.py
示例14: test_missing_style
def test_missing_style():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'missing_style.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<p>AAA</p>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:11,代码来源:test_docx.py
示例15: test_no_break_hyphen
def test_no_break_hyphen():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'no_break_hyphen.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<p>AAA-BBB</p>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:11,代码来源:test_docx.py
示例16: test_split_headers
def test_split_headers():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'split_header.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<h1>AAA</h1><p>BBB</p><h1>CCC</h1>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:12,代码来源:test_docx.py
示例17: test_styled_bolding
def test_styled_bolding():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'styled_bolding.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<p><strong>AAA</strong></p>
<p><strong>BBB</strong></p>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:12,代码来源:test_docx.py
示例18: test_super_and_subscript
def test_super_and_subscript():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'super_and_subscript.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<p>AAA<sup>BBB</sup></p>
<p><sub>CCC</sub>DDD</p>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:12,代码来源:test_docx.py
示例19: test_has_title
def test_has_title():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'has_title.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<p>Title</p>
<p><div class='pydocx-left'>Text</div></p>
''')
开发者ID:Isendir,项目名称:pydocx,代码行数:12,代码来源:test_docx.py
示例20: test_include_tabs
def test_include_tabs():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'include_tabs.docx',
)
actual_html = convert(file_path)
expected_html = BASE_HTML % (
'<p>AAA<span class="pydocx-tab"> </span>BBB</p>'
)
assert_html_equal(actual_html, expected_html)
开发者ID:07pack,项目名称:pydocx,代码行数:12,代码来源:test_docx.py
注:本文中的pydocx.tests.assert_html_equal函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论