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: ...@@ -414,12 +414,7 @@ class ERP5Diff:
</node>") </node>")
tree.node.text == '\n ' tree.node.text == '\n '
""" """
for child in element: return not [text for text in element.xpath('text()') if text.strip()]
if type(child) == etree._Element:
return True
if element.text is None:
return True
return bool(element.text.strip()) is False or False
def _makeRelativePathList(self, element_list, before=0): def _makeRelativePathList(self, element_list, before=0):
""" """
......
...@@ -1111,5 +1111,25 @@ class TestERP5Diff(unittest.TestCase): ...@@ -1111,5 +1111,25 @@ class TestERP5Diff(unittest.TestCase):
self._assertERP5DiffWorks(old_xml, new_xml, expected_result_string) 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__': if __name__ == '__main__':
unittest.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