1*e1fe3e4aSElliott Hughesimport unittest 2*e1fe3e4aSElliott Hughesimport fontTools.encodings.codecs # Not to be confused with "import codecs" 3*e1fe3e4aSElliott Hughes 4*e1fe3e4aSElliott Hughes 5*e1fe3e4aSElliott Hughesclass ExtendedCodecsTest(unittest.TestCase): 6*e1fe3e4aSElliott Hughes def test_decode_mac_japanese(self): 7*e1fe3e4aSElliott Hughes self.assertEqual( 8*e1fe3e4aSElliott Hughes b"x\xfe\xfdy".decode("x_mac_japanese_ttx"), 9*e1fe3e4aSElliott Hughes chr(0x78) + chr(0x2122) + chr(0x00A9) + chr(0x79), 10*e1fe3e4aSElliott Hughes ) 11*e1fe3e4aSElliott Hughes 12*e1fe3e4aSElliott Hughes def test_encode_mac_japanese(self): 13*e1fe3e4aSElliott Hughes self.assertEqual( 14*e1fe3e4aSElliott Hughes b"x\xfe\xfdy", 15*e1fe3e4aSElliott Hughes (chr(0x78) + chr(0x2122) + chr(0x00A9) + chr(0x79)).encode( 16*e1fe3e4aSElliott Hughes "x_mac_japanese_ttx" 17*e1fe3e4aSElliott Hughes ), 18*e1fe3e4aSElliott Hughes ) 19*e1fe3e4aSElliott Hughes 20*e1fe3e4aSElliott Hughes def test_decode_mac_trad_chinese(self): 21*e1fe3e4aSElliott Hughes self.assertEqual(b"\x80".decode("x_mac_trad_chinese_ttx"), chr(0x5C)) 22*e1fe3e4aSElliott Hughes 23*e1fe3e4aSElliott Hughes def test_decode_mac_romanian(self): 24*e1fe3e4aSElliott Hughes self.assertEqual(b"x\xfb".decode("mac_romanian"), chr(0x78) + chr(0x02DA)) 25*e1fe3e4aSElliott Hughes 26*e1fe3e4aSElliott Hughes 27*e1fe3e4aSElliott Hughesif __name__ == "__main__": 28*e1fe3e4aSElliott Hughes import sys 29*e1fe3e4aSElliott Hughes 30*e1fe3e4aSElliott Hughes sys.exit(unittest.main()) 31