[IMP] qweb: use CDATA in test and remove stringify_children method
This commit is contained in:
@@ -21,12 +21,12 @@
|
||||
<t t-else="t-else">ok-else</t><span>end</span></div>
|
||||
</t>
|
||||
<params id="boolean-value-condition-else">{"condition": true}</params>
|
||||
<result id="boolean-value-condition-else"><div><span>begin</span>ok<span>end</span></div></result>
|
||||
<result id="boolean-value-condition-else"><![CDATA[<div><span>begin</span>ok<span>end</span></div>]]></result>
|
||||
|
||||
<t t-name="boolean-value-condition-false-else">
|
||||
<div><span>begin</span><t t-if="condition">fail</t>
|
||||
<t t-else="t-else">fail-else</t><span>end</span></div>
|
||||
</t>
|
||||
<params id="boolean-value-condition-false-else">{"condition": false}</params>
|
||||
<result id="boolean-value-condition-false-else"><div><span>begin</span>fail-else<span>end</span></div></result>
|
||||
<result id="boolean-value-condition-false-else"><![CDATA[<div><span>begin</span>fail-else<span>end</span></div>]]></result>
|
||||
</templates>
|
||||
|
||||
@@ -86,12 +86,6 @@ class FileSystemLoader(object):
|
||||
arch = etree.tostring(root, encoding='utf-8', xml_declaration=True)
|
||||
return arch
|
||||
|
||||
def stringify_children(node):
|
||||
parts = ([node.text] +
|
||||
list(chain(*([c.text, etree.tostring(c), c.tail] for c in node.getchildren() if not isinstance(c, etree._Comment)))) +
|
||||
[node.tail])
|
||||
# filter removes possible Nones in texts and tails
|
||||
return ''.join(filter(None, parts))
|
||||
|
||||
class TestQWeb(TransactionCase):
|
||||
matcher = re.compile(r'^qweb-test-(.*)\.xml$')
|
||||
@@ -132,7 +126,7 @@ class TestQWeb(TransactionCase):
|
||||
# so output is predictable & repeatable
|
||||
params = {} if param is None else json.loads(param.text, object_pairs_hook=collections.OrderedDict)
|
||||
|
||||
result = stringify_children(doc.find('result[@id="{}"]'.format(template)))
|
||||
result = doc.find('result[@id="{}"]'.format(template)).text
|
||||
self.assertEqual(
|
||||
qweb.render(template, values=params, load=loader).strip().encode('utf-8'),
|
||||
(result or u'').strip().encode('utf-8'),
|
||||
|
||||
Reference in New Issue
Block a user