Do not use translate to delete chars

In python3, str.translate() only takes one argument, we can not use
it to delete specific chars. Use other method instead.

Partially-Implements: blueprint magnum-python3

Change-Id: I3e1ab0969b9ef9bb8240195b8cb1496bd9bc2e4a
This commit is contained in:
Yang Hongyang 2016-02-27 22:22:46 +08:00
parent 34608c9503
commit 581fe6a863
1 changed files with 2 additions and 1 deletions

View File

@ -68,5 +68,6 @@ class ShortIdTest(testtools.TestCase):
for id in ids:
self.assertEqual(12, len(id))
self.assertFalse(id.translate(None, allowed_chars))
s = ''.join(ch for ch in id if ch not in allowed_chars)
self.assertEqual(s, '')
self.assertEqual(1, ids.count(id))