• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import unittest
2import fontTools.encodings.codecs # Not to be confused with "import codecs"
3
4class ExtendedCodecsTest(unittest.TestCase):
5
6	def test_decode_mac_japanese(self):
7		self.assertEqual(b'x\xfe\xfdy'.decode("x_mac_japanese_ttx"),
8				 chr(0x78)+chr(0x2122)+chr(0x00A9)+chr(0x79))
9
10	def test_encode_mac_japanese(self):
11		self.assertEqual(b'x\xfe\xfdy',
12				 (chr(0x78)+chr(0x2122)+chr(0x00A9)+chr(0x79)).encode("x_mac_japanese_ttx"))
13
14	def test_decode_mac_trad_chinese(self):
15		self.assertEqual(b'\x80'.decode("x_mac_trad_chinese_ttx"),
16				 chr(0x5C))
17
18	def test_decode_mac_romanian(self):
19		self.assertEqual(b'x\xfb'.decode("mac_romanian"),
20				 chr(0x78)+chr(0x02DA))
21
22if __name__ == '__main__':
23	import sys
24	sys.exit(unittest.main())
25