diff options
author | Georg Brandl <georg@python.org> | 2007-10-23 06:52:59 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-10-23 06:52:59 (GMT) |
commit | 94c2c75b5eda49ccbb01778f9ab188fc1dbc1ca2 (patch) | |
tree | 15b115f65cc65c6837e02f05957ccece3b51c47b /Lib/test/test_unicode.py | |
parent | 3b8cb17695209c48bfc618ba265d201e81d1603a (diff) | |
download | cpython-94c2c75b5eda49ccbb01778f9ab188fc1dbc1ca2.zip cpython-94c2c75b5eda49ccbb01778f9ab188fc1dbc1ca2.tar.gz cpython-94c2c75b5eda49ccbb01778f9ab188fc1dbc1ca2.tar.bz2 |
Patch #1071: Improve unicode.translate() so that you can pass unicode
characters as mapping keys and invalid mapping keys are recognized
and raise an error.
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r-- | Lib/test/test_unicode.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 04dddaa..9aad59a 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -160,12 +160,14 @@ class UnicodeTest( self.checkequalnofix('bbbc', 'abababc', 'translate', {ord('a'):None}) self.checkequalnofix('iiic', 'abababc', 'translate', {ord('a'):None, ord('b'):ord('i')}) self.checkequalnofix('iiix', 'abababc', 'translate', {ord('a'):None, ord('b'):ord('i'), ord('c'):'x'}) - self.checkequalnofix('<i><i><i>c', 'abababc', 'translate', {ord('a'):None, ord('b'):'<i>'}) + self.checkequalnofix('<i><i><i>c', 'abababc', 'translate', {'a':None, 'b':'<i>'}) self.checkequalnofix('c', 'abababc', 'translate', {ord('a'):None, ord('b'):''}) self.checkequalnofix('xyyx', 'xzx', 'translate', {ord('z'):'yy'}) self.assertRaises(TypeError, 'hello'.translate) self.assertRaises(TypeError, 'abababc'.translate, 'abc', 'xyz') + self.assertRaises(ValueError, 'abababc'.translate, {'xy':2}) + self.assertRaises(TypeError, 'abababc'.translate, {(1,):2}) def test_split(self): string_tests.CommonTest.test_split(self) |