fallback untouched html if we can not parse html tree

This commit is contained in:
Sergey Obukhov
2016-08-19 11:38:12 -07:00
parent 5b1ca33c57
commit 37c95ff97b
4 changed files with 45 additions and 3 deletions

View File

@@ -413,3 +413,9 @@ def test_readable_html_empty():
eq_(RE_WHITESPACE.sub('', msg_body),
RE_WHITESPACE.sub('', quotations.extract_from_html(msg_body)))
@patch.object(quotations, 'html_document_fromstring', Mock(return_value=None))
def test_bad_html():
bad_html = "<html></html>"
eq_(bad_html, quotations.extract_from_html(bad_html))