Beispiel #1
0
 def test_split_long_unicode(self):
     """Are words with multi-byte chars split correctly?"""
     # Repeated failures lead to success.
     msg = "失敗を繰り返すことで、成功に至る。"
     expected = [to_bytes("失敗を繰り返"), to_bytes("すことで、成"), to_bytes("功に至る。")]
     messages = chunk_message(msg, max_length=20)
     self.assertEqual(messages, expected)
Beispiel #2
0
 def test_not_bytes_or_string(self):
     with self.assertRaises(AttributeError):
         to_bytes(None)
Beispiel #3
0
 def test_already_bytes(self):
     text = b'bytes!'
     result = to_bytes(text)
     self.assertEqual(result, text)
Beispiel #4
0
 def test_unicode(self):
     text = 'ಠ_ಠ'
     expected = b'\xe0\xb2\xa0_\xe0\xb2\xa0'
     result = to_bytes(text)
     self.assertEqual(result, expected)
Beispiel #5
0
 def test_unicode(self):
     text = "ಠ_ಠ"
     expected = b"\xe0\xb2\xa0_\xe0\xb2\xa0"
     result = to_bytes(text)
     self.assertEqual(result, expected)