diff options
author | Rod S <rsheeter@google.com> | 2022-03-25 12:41:45 -0700 |
---|---|---|
committer | Seigo Nonaka <nona@google.com> | 2022-03-25 12:49:44 -0700 |
commit | 0b59a54a78ee22be83fe249c724c19ebd7d26ede (patch) | |
tree | 98d81cb66669c50af608fd8a844e22039a00f5ae /Tests/misc/xmlWriter_test.py | |
parent | 7464785773cfc59c180c0dbd4b8f91dbe9d5c49f (diff) | |
download | fonttools-0b59a54a78ee22be83fe249c724c19ebd7d26ede.tar.gz |
Update FontTools to 4.31.2 to gain access to iterSubTables.
Needed to facilitate implementation of additional emoji font validation.
Ran tools/external_updater/updater.sh update fonttools
Bug: 226676748
Test: will run presubmit
Test: m fontchain_lint
Change-Id: I1207eea8394848bd2ef5040de9aebc8f940b1d96
Diffstat (limited to 'Tests/misc/xmlWriter_test.py')
-rw-r--r-- | Tests/misc/xmlWriter_test.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Tests/misc/xmlWriter_test.py b/Tests/misc/xmlWriter_test.py index fd4f2408..69471543 100644 --- a/Tests/misc/xmlWriter_test.py +++ b/Tests/misc/xmlWriter_test.py @@ -1,11 +1,10 @@ -from fontTools.misc.py23 import bytesjoin, tobytes from io import BytesIO import os import unittest +from fontTools.misc.textTools import bytesjoin, tobytes from fontTools.misc.xmlWriter import XMLWriter -linesep = tobytes(os.linesep) -HEADER = b'<?xml version="1.0" encoding="UTF-8"?>' + linesep +HEADER = b'<?xml version="1.0" encoding="UTF-8"?>\n' class TestXMLWriter(unittest.TestCase): @@ -17,30 +16,30 @@ class TestXMLWriter(unittest.TestCase): def test_comment_multiline(self): writer = XMLWriter(BytesIO()) writer.comment("Hello world\nHow are you?") - self.assertEqual(HEADER + b"<!-- Hello world" + linesep + b" How are you? -->", + self.assertEqual(HEADER + b"<!-- Hello world\n How are you? -->", writer.file.getvalue()) def test_encoding_default(self): writer = XMLWriter(BytesIO()) - self.assertEqual(b'<?xml version="1.0" encoding="UTF-8"?>' + linesep, + self.assertEqual(b'<?xml version="1.0" encoding="UTF-8"?>\n', writer.file.getvalue()) def test_encoding_utf8(self): # https://github.com/fonttools/fonttools/issues/246 writer = XMLWriter(BytesIO(), encoding="utf8") - self.assertEqual(b'<?xml version="1.0" encoding="UTF-8"?>' + linesep, + self.assertEqual(b'<?xml version="1.0" encoding="UTF-8"?>\n', writer.file.getvalue()) def test_encoding_UTF_8(self): # https://github.com/fonttools/fonttools/issues/246 writer = XMLWriter(BytesIO(), encoding="UTF-8") - self.assertEqual(b'<?xml version="1.0" encoding="UTF-8"?>' + linesep, + self.assertEqual(b'<?xml version="1.0" encoding="UTF-8"?>\n', writer.file.getvalue()) def test_encoding_UTF8(self): # https://github.com/fonttools/fonttools/issues/246 writer = XMLWriter(BytesIO(), encoding="UTF8") - self.assertEqual(b'<?xml version="1.0" encoding="UTF-8"?>' + linesep, + self.assertEqual(b'<?xml version="1.0" encoding="UTF-8"?>\n', writer.file.getvalue()) def test_encoding_other(self): @@ -61,7 +60,7 @@ class TestXMLWriter(unittest.TestCase): writer.newline() writer.dedent() writer.write("baz") - self.assertEqual(HEADER + bytesjoin(["foo", " bar", "baz"], linesep), + self.assertEqual(HEADER + bytesjoin(["foo", " bar", "baz"], "\n"), writer.file.getvalue()) def test_writecdata(self): @@ -89,7 +88,7 @@ class TestXMLWriter(unittest.TestCase): "66756c20 67726f75 70206f66 206c6574", "74657273 2c206e6f 74206120 67726f75", "70206f66 20626561 75746966 756c206c", - "65747465 72732e ", ""], joiner=linesep), writer.file.getvalue()) + "65747465 72732e ", ""], joiner="\n"), writer.file.getvalue()) def test_stringifyattrs(self): writer = XMLWriter(BytesIO()) |