From 828a58aacb892d3c8d7ef33ae9c4d0b567708c72 Mon Sep 17 00:00:00 2001 From: Jens Kutilek Date: Tue, 24 Jan 2017 15:30:32 +0100 Subject: [PATCH] Better fix for checking line endings, use UnicodeIO instead of BytesIO --- Tests/ttLib/tables/ttProgram_test.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Tests/ttLib/tables/ttProgram_test.py b/Tests/ttLib/tables/ttProgram_test.py index 8abc9b575..bcb463b71 100644 --- a/Tests/ttLib/tables/ttProgram_test.py +++ b/Tests/ttLib/tables/ttProgram_test.py @@ -4,7 +4,6 @@ from fontTools.misc.xmlWriter import XMLWriter from fontTools.ttLib.tables.ttProgram import Program from fontTools.misc.textTools import deHexStr import array -import io import os import re import unittest @@ -101,19 +100,19 @@ class ProgramTest(unittest.TestCase): assert BYTECODE == p.getBytecode() def test_xml_indentation(self): - with open(TTPROGRAM_TTX, 'rb') as f: - ttProgramXML = f.read().splitlines() + with open(TTPROGRAM_TTX, 'r') as f: + ttProgramXML = f.read() p = Program() p.fromBytecode(BYTECODE) ttfont = TestFont() - buf = io.BytesIO() + buf = UnicodeIO() writer = XMLWriter(buf) try: p.toXML(writer, ttfont) finally: output_string = buf.getvalue() buf.close() - assert output_string.splitlines() == ttProgramXML + assert output_string == ttProgramXML if __name__ == '__main__':