mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Better error message for failed test
This commit is contained in:
parent
6e155612b4
commit
fd896540d7
@ -64,8 +64,15 @@ def find_tests():
|
|||||||
('PUBLIC', external, None),
|
('PUBLIC', external, None),
|
||||||
('PUBLIC', 'http://example.com', None),
|
('PUBLIC', 'http://example.com', None),
|
||||||
):
|
):
|
||||||
got = getattr(safe_xml_fromstring(templ.format(id=eid, val=val)), 'text', None)
|
raw = templ.format(id=eid, val=val)
|
||||||
self.assertEqual(got, expected)
|
err = None
|
||||||
|
try:
|
||||||
|
root = safe_xml_fromstring(raw)
|
||||||
|
except Exception as e:
|
||||||
|
err = str(e)
|
||||||
|
root = None
|
||||||
|
got = getattr(root, 'text', object())
|
||||||
|
self.assertEqual(got, expected, f'Unexpected result parsing: {raw!r}, got: {got!r} expected: {expected!r} with XML parser error: {err}')
|
||||||
|
|
||||||
def test_lxml_unicode_parsing(self):
|
def test_lxml_unicode_parsing(self):
|
||||||
from calibre.ebooks.chardet import xml_to_unicode
|
from calibre.ebooks.chardet import xml_to_unicode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user