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