[_n_a_m_e_test] use toUnicode() instead of built-in str() for py2 compat
NameRecord.__str__ returns a unicode string, but on Python2 the built-in str() expects a bytestring, therefore it raises UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128) We should probably change that as well.
This commit is contained in:
parent
898199f2bc
commit
12bde8e97a
@ -33,12 +33,12 @@ class NameTableTest(unittest.TestCase):
|
||||
table.setName("Regular", 2, 1, 0, 0)
|
||||
table.setName("Version 1.000", 5, 3, 1, 0x409)
|
||||
table.setName("寬鬆", 276, 1, 2, 0x13)
|
||||
self.assertEqual("Regular", str(table.getName(2, 1, 0, 0)))
|
||||
self.assertEqual("Version 1.000", str(table.getName(5, 3, 1, 0x409)))
|
||||
self.assertEqual("寬鬆", str(table.getName(276, 1, 2, 0x13)))
|
||||
self.assertEqual("Regular", table.getName(2, 1, 0, 0).toUnicode())
|
||||
self.assertEqual("Version 1.000", table.getName(5, 3, 1, 0x409).toUnicode())
|
||||
self.assertEqual("寬鬆", table.getName(276, 1, 2, 0x13).toUnicode())
|
||||
self.assertTrue(len(table.names) == 3)
|
||||
table.setName("緊縮", 276, 1, 2, 0x13)
|
||||
self.assertEqual("緊縮", str(table.getName(276, 1, 2, 0x13)))
|
||||
self.assertEqual("緊縮", table.getName(276, 1, 2, 0x13).toUnicode())
|
||||
self.assertTrue(len(table.names) == 3)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user