Commit 17a51e44 authored by Nicolas Delaby's avatar Nicolas Delaby

Tail text nodes was not detected (...<node/>blablabla...)

parent f6a1fbf0
......@@ -414,12 +414,7 @@ class ERP5Diff:
</node>")
tree.node.text == '\n '
"""
for child in element:
if type(child) == etree._Element:
return True
if element.text is None:
return True
return bool(element.text.strip()) is False or False
return not [text for text in element.xpath('text()') if text.strip()]
def _makeRelativePathList(self, element_list, before=0):
"""
......
......@@ -1111,5 +1111,25 @@ class TestERP5Diff(unittest.TestCase):
self._assertERP5DiffWorks(old_xml, new_xml, expected_result_string)
def test_text_node_in_tails(self):
"""31. Check tail of elements ...<node/>blablabla...
"""
old_xml = """
<ul>
<node/>blablabla
</ul>
"""
new_xml = """
<ul>
<node/>yayaya
</ul>
"""
expected_result_string = """<xupdate:modifications xmlns:xupdate="http://www.xmldb.org/xupdate" version="1.0">
<xupdate:update select="/ul"><node/>yayaya
</xupdate:update>
</xupdate:modifications>
"""
self._assertERP5DiffWorks(old_xml, new_xml, expected_result_string)
if __name__ == '__main__':
unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment