diff --git a/Lib/test/test_charmapcodec.py b/Lib/test/test_charmapcodec.py index d5981be8bd7..5e4055eec94 100644 --- a/Lib/test/test_charmapcodec.py +++ b/Lib/test/test_charmapcodec.py @@ -27,27 +27,27 @@ codecname = 'testcodec' class CharmapCodecTest(unittest.TestCase): def test_constructorx(self): - self.assertEquals(str('abc', codecname), 'abc') - self.assertEquals(str('xdef', codecname), 'abcdef') - self.assertEquals(str('defx', codecname), 'defabc') - self.assertEquals(str('dxf', codecname), 'dabcf') - self.assertEquals(str('dxfx', codecname), 'dabcfabc') + self.assertEquals(str(b'abc', codecname), 'abc') + self.assertEquals(str(b'xdef', codecname), 'abcdef') + self.assertEquals(str(b'defx', codecname), 'defabc') + self.assertEquals(str(b'dxf', codecname), 'dabcf') + self.assertEquals(str(b'dxfx', codecname), 'dabcfabc') def test_encodex(self): - self.assertEquals('abc'.encode(codecname), 'abc') - self.assertEquals('xdef'.encode(codecname), 'abcdef') - self.assertEquals('defx'.encode(codecname), 'defabc') - self.assertEquals('dxf'.encode(codecname), 'dabcf') - self.assertEquals('dxfx'.encode(codecname), 'dabcfabc') + self.assertEquals('abc'.encode(codecname), b'abc') + self.assertEquals('xdef'.encode(codecname), b'abcdef') + self.assertEquals('defx'.encode(codecname), b'defabc') + self.assertEquals('dxf'.encode(codecname), b'dabcf') + self.assertEquals('dxfx'.encode(codecname), b'dabcfabc') def test_constructory(self): - self.assertEquals(str('ydef', codecname), 'def') - self.assertEquals(str('defy', codecname), 'def') - self.assertEquals(str('dyf', codecname), 'df') - self.assertEquals(str('dyfy', codecname), 'df') + self.assertEquals(str(b'ydef', codecname), 'def') + self.assertEquals(str(b'defy', codecname), 'def') + self.assertEquals(str(b'dyf', codecname), 'df') + self.assertEquals(str(b'dyfy', codecname), 'df') def test_maptoundefined(self): - self.assertRaises(UnicodeError, str, 'abc\001', codecname) + self.assertRaises(UnicodeError, str, b'abc\001', codecname) def test_main(): test.test_support.run_unittest(CharmapCodecTest) diff --git a/Lib/test/testcodec.py b/Lib/test/testcodec.py index 7ac9203d3cd..e7f836be704 100644 --- a/Lib/test/testcodec.py +++ b/Lib/test/testcodec.py @@ -36,7 +36,7 @@ def getregentry(): decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ 0x78: "abc", # 1-n decoding mapping - "abc": 0x0078,# 1-n encoding mapping + str8("abc"): 0x0078,# 1-n encoding mapping 0x01: None, # decoding mapping to 0x79: "", # decoding mapping to })