Ejemplo n.º 1
0
 def test_converts_all_unicode_to_utf8_bytes_recursively(self):
   e = {
     b("l"): [constants.UTF8_BYTES2, constants.UTF8_BYTES],
     b("t"): (constants.UTF8_BYTES2, constants.UTF8_BYTES),
     b("d"): {b("another"): [constants.UTF8_BYTES, constants.UTF8_BYTES2]},
     b("b"): constants.UTF8_BYTES,
     b("n"): None,
     }
   p = {
     "l": [constants.UNICODE_STRING2, constants.UNICODE_STRING],
     "t": (constants.UNICODE_STRING2, constants.UNICODE_STRING),
     "d": dict(another=[constants.UNICODE_STRING, constants.UNICODE_STRING2]),
     "b": constants.UNICODE_STRING,
     "n": None,
     }
   self.assertDictEqual(text.utf8_encode_recursive(p), e)
Ejemplo n.º 2
0
 def test_converts_all_unicode_to_utf8_bytes_recursively(self):
   e = {
     b("l"): [utf8_bytes2, utf8_bytes],
     b("t"): (utf8_bytes2, utf8_bytes),
     b("d"): {b('another'): [utf8_bytes, utf8_bytes2]},
     b("b"): utf8_bytes,
     b("n"): None,
     }
   p = {
     "l": [unicode_string2, unicode_string],
     "t": (unicode_string2, unicode_string),
     "d": dict(another=[unicode_string, unicode_string2]),
     "b": unicode_string,
     "n": None,
     }
   self.assertDictEqual(utf8_encode_recursive(p), e)