mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
Fixed SleekTest compare method to check XML text.
Corrected resulting test failures. All pass again.
This commit is contained in:
parent
bb6f4af8e2
commit
906aa0bd68
2 changed files with 14 additions and 3 deletions
|
@ -504,7 +504,18 @@ class SleekTest(unittest.TestCase):
|
||||||
if xml.attrib != other.attrib:
|
if xml.attrib != other.attrib:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Step 3: Recursively check children
|
# Step 3: Check text
|
||||||
|
if xml.text is None:
|
||||||
|
xml.text = ""
|
||||||
|
if other.text is None:
|
||||||
|
other.text = ""
|
||||||
|
xml.text = xml.text.strip()
|
||||||
|
other.text = other.text.strip()
|
||||||
|
|
||||||
|
if xml.text != other.text:
|
||||||
|
return False
|
||||||
|
|
||||||
|
# Step 4: Recursively check children
|
||||||
for child in xml:
|
for child in xml:
|
||||||
child2s = other.findall("%s" % child.tag)
|
child2s = other.findall("%s" % child.tag)
|
||||||
if child2s is None:
|
if child2s is None:
|
||||||
|
|
|
@ -347,7 +347,7 @@ class TestElementBase(SleekTest):
|
||||||
</wrapper>
|
</wrapper>
|
||||||
</foo>
|
</foo>
|
||||||
""")
|
""")
|
||||||
stanza._setSubText('bar', text='', keep=True)
|
stanza._setSubText('wrapper/bar', text='', keep=True)
|
||||||
self.checkStanza(TestStanza, stanza, """
|
self.checkStanza(TestStanza, stanza, """
|
||||||
<foo xmlns="foo">
|
<foo xmlns="foo">
|
||||||
<wrapper>
|
<wrapper>
|
||||||
|
@ -358,7 +358,7 @@ class TestElementBase(SleekTest):
|
||||||
""", use_values=False)
|
""", use_values=False)
|
||||||
|
|
||||||
stanza['bar'] = 'a'
|
stanza['bar'] = 'a'
|
||||||
stanza._setSubText('bar', text='')
|
stanza._setSubText('wrapper/bar', text='')
|
||||||
self.checkStanza(TestStanza, stanza, """
|
self.checkStanza(TestStanza, stanza, """
|
||||||
<foo xmlns="foo">
|
<foo xmlns="foo">
|
||||||
<wrapper>
|
<wrapper>
|
||||||
|
|
Loading…
Reference in a new issue