# coding: utf-8 from __future__ import absolute_import, unicode_literals from ufoLib import etree import io import pytest @pytest.mark.parametrize( "xml", [ ( "" 'text' "texttail" "" "" ), ( "\n" ' text\n' " texttail\n" " \n" "" ), ( '' 'قطر' '' ) ], ids=[ "simple_xml_no_indent", "simple_xml_indent", "xml_ns_attrib_utf_8", ] ) def test_roundtrip_string(xml): root = etree.fromstring(xml.encode("utf-8")) result = etree.tostring(root, encoding="utf-8").decode("utf-8") assert result == xml