SF 1193128: Let str.translate(None) be an identity transformation

This commit is contained in:
Raymond Hettinger 2007-04-12 04:10:00 +00:00
parent 5176180610
commit 4db5fe970c
6 changed files with 33 additions and 10 deletions

View file

@ -1096,6 +1096,9 @@ def test_translate(self):
self.checkequal('Abc', 'abc', 'translate', table)
self.checkequal('xyz', 'xyz', 'translate', table)
self.checkequal('yz', 'xyz', 'translate', table, 'x')
self.checkequal('yx', 'zyzzx', 'translate', None, 'z')
self.checkequal('zyzzx', 'zyzzx', 'translate', None, '')
self.checkequal('zyzzx', 'zyzzx', 'translate', None)
self.checkraises(ValueError, 'xyz', 'translate', 'too short', 'strip')
self.checkraises(ValueError, 'xyz', 'translate', 'too short')