Commit b12db70e authored by Denis Laxalde's avatar Denis Laxalde
Browse files

[py3] Force XML serialization to unicode in html generation tests

In python3, lxml.etree.tostring returns bytes but we expect text in
tests. By passing six.text_type as encoding parameter to this function,
it returns a unicode string.
parent f14dfe93073a
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
from collections import namedtuple from collections import namedtuple
from lxml import etree from lxml import etree
from six import text_type
from cubicweb.devtools.testlib import CubicWebTC from cubicweb.devtools.testlib import CubicWebTC
...@@ -60,7 +61,7 @@ class SEDAHTMLExportFuncTC(SEDAExportFuncTCMixIn, XmlTestMixin, CubicWebTC): ...@@ -60,7 +61,7 @@ class SEDAHTMLExportFuncTC(SEDAExportFuncTCMixIn, XmlTestMixin, CubicWebTC):
el_defs.append(el_def) el_defs.append(el_def)
for span in self.xpath(div, 'span'): for span in self.xpath(div, 'span'):
if len(span): if len(span):
value = etree.tostring(span[0]) value = etree.tostring(span[0], encoding=text_type)
else: else:
value = span.text value = span.text
el_def[span.attrib['class']] = value el_def[span.attrib['class']] = value
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