2015-04-16 03:10:18 -07:00
|
|
|
import unittest
|
|
|
|
import fontTools.encodings.codecs # Not to be confused with "import codecs"
|
|
|
|
|
|
|
|
class ExtendedCodecsTest(unittest.TestCase):
|
|
|
|
|
2015-04-26 00:51:22 -04:00
|
|
|
def test_decode_mac_japanese(self):
|
2015-04-19 04:24:55 -07:00
|
|
|
self.assertEqual(b'x\xfe\xfdy'.decode("x_mac_japanese_ttx"),
|
2021-03-29 11:45:58 +02:00
|
|
|
chr(0x78)+chr(0x2122)+chr(0x00A9)+chr(0x79))
|
2015-04-16 03:10:18 -07:00
|
|
|
|
2015-04-26 00:51:22 -04:00
|
|
|
def test_encode_mac_japanese(self):
|
2015-04-16 03:10:18 -07:00
|
|
|
self.assertEqual(b'x\xfe\xfdy',
|
2021-03-29 11:45:58 +02:00
|
|
|
(chr(0x78)+chr(0x2122)+chr(0x00A9)+chr(0x79)).encode("x_mac_japanese_ttx"))
|
2015-04-16 03:10:18 -07:00
|
|
|
|
2015-04-26 00:51:22 -04:00
|
|
|
def test_decode_mac_trad_chinese(self):
|
|
|
|
self.assertEqual(b'\x80'.decode("x_mac_trad_chinese_ttx"),
|
2021-03-29 11:45:58 +02:00
|
|
|
chr(0x5C))
|
2015-04-26 00:51:22 -04:00
|
|
|
|
|
|
|
def test_decode_mac_romanian(self):
|
2015-04-24 12:32:20 -07:00
|
|
|
self.assertEqual(b'x\xfb'.decode("mac_romanian"),
|
2021-03-29 11:45:58 +02:00
|
|
|
chr(0x78)+chr(0x02DA))
|
2015-04-16 18:24:07 -07:00
|
|
|
|
2015-04-16 03:10:18 -07:00
|
|
|
if __name__ == '__main__':
|
2017-01-11 13:05:35 +00:00
|
|
|
import sys
|
|
|
|
sys.exit(unittest.main())
|