diff options
author | Marc-André Lemburg <mal@egenix.com> | 2004-07-10 12:06:10 (GMT) |
---|---|---|
committer | Marc-André Lemburg <mal@egenix.com> | 2004-07-10 12:06:10 (GMT) |
commit | 3f41974525271c65269c84e4fcda5e5ae207039d (patch) | |
tree | 940f82bdc50929372540f11b5cfe83928a36b9a0 /Lib | |
parent | 126b44cd414c779c9c85743af5d407188947f378 (diff) | |
download | cpython-3f41974525271c65269c84e4fcda5e5ae207039d.zip cpython-3f41974525271c65269c84e4fcda5e5ae207039d.tar.gz cpython-3f41974525271c65269c84e4fcda5e5ae207039d.tar.bz2 |
Add generic codecs.encode() and .decode() APIs that don't impose
any restriction on the return type (like unicode.encode() et al. do).
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_codecs.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index b7abedd..c428c61 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -336,6 +336,15 @@ class CodecTest(unittest.TestCase): def test_builtin(self): self.assertEquals(unicode("python.org", "idna"), u"python.org") +class CodecsModuleTest(unittest.TestCase): + + def test_decode(self): + self.assertEquals(codecs.decode('\xe4\xf6\xfc', 'latin-1'), + u'\xe4\xf6\xfc') + def test_encode(self): + self.assertEquals(codecs.encode(u'\xe4\xf6\xfc', 'latin-1'), + '\xe4\xf6\xfc') + def test_main(): test_support.run_unittest( UTF16Test, @@ -343,7 +352,8 @@ def test_main(): RecodingTest, PunycodeTest, NameprepTest, - CodecTest + CodecTest, + CodecsModuleTest ) |