diff --git a/src/calibre/ebooks/oeb/polish/tests/parsing.py b/src/calibre/ebooks/oeb/polish/tests/parsing.py index 9f5df26063..d7443ef739 100644 --- a/src/calibre/ebooks/oeb/polish/tests/parsing.py +++ b/src/calibre/ebooks/oeb/polish/tests/parsing.py @@ -167,6 +167,13 @@ basic_checks = (nonvoid_cdata_elements, namespaces, space_characters, class ParsingTests(BaseTest): + def test_lxml_tostring(self): + ' Test for bug in some versions of lxml that causes incorrect serialization of sub-trees' + from html5_parser import parse + root = parse('
a
b
c') + p = root.xpath('//p')[0] + self.assertEqual(etree.tostring(p, encoding=str), '
a
') + def test_conversion_parser(self): ' Test parsing with the HTML5 parser used for conversion ' for test in basic_checks: