def test_convert_spans(self):
expected = '''
<p>
<em><strong>
foobar
<em>
lala
<strong>
yum
</strong>
</em>
<span>
hey hey
</span>
<strong>
uh oh
</strong>
<span>
yes
</span>
</strong></em>
</p>
'''
h = fromstring(html)
for span in h.findall('.//span'):
html2md.convert_span(span)
result = tostring(h).decode('utf-8')
results = [x.replace('\n', '').replace(' ', '') for x in [result, expected]]
print('=========')
print(results[0])
print('=========')
print(results[1])
self.assertEqual(results[0], results[1])
评论列表
文章目录