예제 #1
0
 def test_to_bytes_with_both_encoding_specified(self):
     encoded_bytes_msg = u'message'.encode('utf-16')
     result = strings.to_bytes(encoded_bytes_msg, in_enc='utf-16',
                               out_enc='utf-32')
     assert result == u'message'.encode('utf-32')
예제 #2
0
 def test_to_bytes_with_specific_input_encoding(self):
     encoded_bytes_msg = u'ééé'.encode('utf-7')
     result = strings.to_bytes(encoded_bytes_msg, in_enc='utf-7')
     assert result == u'ééé'.encode('utf-8')  # utf-8 is the default output.
예제 #3
0
 def test_to_bytes_with_specific_output_encoding(self):
     encoded_bytes_msg = u'message'.encode('utf-32')
     result = strings.to_bytes('message', out_enc='utf-32')
     assert result == encoded_bytes_msg
예제 #4
0
 def test_to_bytes(self):
     for msg in self.all_strings:
         result = strings.to_bytes(msg)
         assert isinstance(result, bytes)