Lines Matching refs:maketrans
329 tbl = self.type2test.maketrans({'a': None, 'b': '<i>'})
332 tbl = self.type2test.maketrans('abc', 'xyz', 'd')
337 self.assertEqual("[a]".translate(str.maketrans('a', 'X')),
339 self.assertEqual("[a]".translate(str.maketrans({'a': 'X'})),
341 self.assertEqual("[a]".translate(str.maketrans({'a': None})),
343 self.assertEqual("[a]".translate(str.maketrans({'a': 'XXX'})),
345 self.assertEqual("[a]".translate(str.maketrans({'a': '\xe9'})),
347 self.assertEqual('axb'.translate(str.maketrans({'a': None, 'b': '123'})),
349 self.assertEqual('axb'.translate(str.maketrans({'a': None, 'b': '\xe9'})),
353 self.assertEqual("[a]".translate(str.maketrans({'a': '<\xe9>'})),
355 self.assertEqual("[\xe9]".translate(str.maketrans({'\xe9': 'a'})),
357 self.assertEqual("[\xe9]".translate(str.maketrans({'\xe9': None})),
359 self.assertEqual("[\xe9]".translate(str.maketrans({'\xe9': '123'})),
361 self.assertEqual("[a\xe9]".translate(str.maketrans({'a': '<\u20ac>'})),
367 mapping = str.maketrans({before: invalid_char})
372 self.assertRaises(TypeError, self.type2test.maketrans)
373 self.assertRaises(ValueError, self.type2test.maketrans, 'abc', 'defg')
374 self.assertRaises(TypeError, self.type2test.maketrans, 2, 'def')
375 self.assertRaises(TypeError, self.type2test.maketrans, 'abc', 2)
376 self.assertRaises(TypeError, self.type2test.maketrans, 'abc', 'def', 2)
377 self.assertRaises(ValueError, self.type2test.maketrans, {'xy': 2})
378 self.assertRaises(TypeError, self.type2test.maketrans, {(1,): 2})