[mtiLib] Fix warnings in tests with Python3

This commit is contained in:
Behdad Esfahbod 2016-12-26 20:15:53 -05:00
parent 31b6aab8e1
commit 0661b0805b

View File

@ -92,12 +92,15 @@ class BuilderTest(unittest.TestCase):
self.fail("TTX output is different from expected") self.fail("TTX output is different from expected")
def check_mti_file(self, name, tableTag=None): def check_mti_file(self, name, tableTag=None):
xml_expected_path = self.getpath("%s.ttx" % name + ('.'+tableTag if tableTag is not None else '')) xml_expected_path = self.getpath("%s.ttx" % name + ('.'+tableTag if tableTag is not None else ''))
xml_expected = open(xml_expected_path, 'rt', encoding="utf-8").read() with open(xml_expected_path, 'rt', encoding="utf-8") as xml_expected_file:
f = open(self.getpath("%s.txt" % name), 'rt', encoding="utf-8") xml_expected = xml_expected_file.read()
font = MockFont() font = MockFont()
table = mtiLib.build(f, font, tableTag=tableTag)
with open(self.getpath("%s.txt" % name), 'rt', encoding="utf-8") as f:
table = mtiLib.build(f, font, tableTag=tableTag)
if tableTag is not None: if tableTag is not None:
self.assertEqual(tableTag, table.tableTag) self.assertEqual(tableTag, table.tableTag)