summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-05-23 19:00:48 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-05-23 19:00:48 (GMT)
commiteab198d2298a7186ae0a18382a12c864a4bb59a3 (patch)
treebaa227c15d71c761402f43213a01f05af2f8b7a2
parente53309ce4715262e9dcb6fb09177d61dcdb86c41 (diff)
downloadcpython-eab198d2298a7186ae0a18382a12c864a4bb59a3.zip
cpython-eab198d2298a7186ae0a18382a12c864a4bb59a3.tar.gz
cpython-eab198d2298a7186ae0a18382a12c864a4bb59a3.tar.bz2
Fix testcodec.py and test_charmapcodec.py
-rw-r--r--Lib/test/test_charmapcodec.py30
-rw-r--r--Lib/test/testcodec.py2
2 files changed, 16 insertions, 16 deletions
diff --git a/Lib/test/test_charmapcodec.py b/Lib/test/test_charmapcodec.py
index d5981be..5e4055e 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 7ac9203..e7f836b 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 <undefined>
0x79: "", # decoding mapping to <remove character>
})