This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
importfontTools.misc.testToolsastestTools
importunittest
classTestToolsTest(unittest.TestCase):
deftest_parseXML_str(self):
self.assertEqual(testTools.parseXML(
'<Foo n="1"/>'
'<Foo n="2">'
' some ünıcòðe text'
' <Bar color="red"/>'
' some more text'
'</Foo>'
'<Foo n="3"/>'),[
("Foo",{"n":"1"},[]),
("Foo",{"n":"2"},[
" some ünıcòðe text ",
("Bar",{"color":"red"},[]),
" some more text",
]),
("Foo",{"n":"3"},[])
])
deftest_parseXML_bytes(self):
self.assertEqual(testTools.parseXML(
b'<Foo n="1"/>'
b'<Foo n="2">'
b' some \xc3\xbcn\xc4\xb1c\xc3\xb2\xc3\xb0e text'
b' <Bar color="red"/>'
b' some more text'
b'</Foo>'
b'<Foo n="3"/>'),[
("Foo",{"n":"1"},[]),
("Foo",{"n":"2"},[
" some ünıcòðe text ",
("Bar",{"color":"red"},[]),
" some more text",
]),
("Foo",{"n":"3"},[])
])
deftest_parseXML_str_list(self):
self.assertEqual(testTools.parseXML(
['<Foo n="1"/>'
'<Foo n="2"/>']),[
("Foo",{"n":"1"},[]),
("Foo",{"n":"2"},[])
])
deftest_parseXML_bytes_list(self):
self.assertEqual(testTools.parseXML(
[b'<Foo n="1"/>'
b'<Foo n="2"/>']),[
("Foo",{"n":"1"},[]),
("Foo",{"n":"2"},[])
])
deftest_getXML(self):
deftoXML(writer,ttFont):
writer.simpletag("simple")
writer.newline()
writer.begintag("tag",attr='value')
writer.newline()
writer.write("hello world")
writer.newline()
writer.endtag("tag")
writer.newline()# toXML always ends with a newline