Exemplo n.º 1
0
 def test_decode_unknown_high_characters(self):
     """Test decode with non-ascii characters in an unknown encoding."""
     with self.expectedLog('Treating unknown encoding "booga" as latin-1.'):
         result = MessageSet.decode(self.high_characters, 'booga')
     self.assertEqual(self.high_characters.decode('latin-1'), result)
Exemplo n.º 2
0
 def test_decode_macintosh(self):
     """Test decode with macintosh encoding."""
     result = MessageSet.decode(self.high_characters, 'macintosh')
     self.assertEqual(self.high_characters.decode('macroman'), result)
Exemplo n.º 3
0
 def test_decode_unknown_ascii(self):
     """Test decode with ascii characters in an unknown encoding."""
     result = MessageSet.decode('abcde', 'booga')
     self.assertEqual(u'abcde', result)
Exemplo n.º 4
0
 def test_decode_utf8(self):
     """Test decode with a known encoding."""
     result = MessageSet.decode(u'\u1234'.encode('utf-8'), 'utf-8')
     self.assertEqual(u'\u1234', result)
Exemplo n.º 5
0
 def test_decode_unknown_high_characters(self):
     """Test decode with non-ascii characters in an unknown encoding."""
     with self.expectedLog(
         'Treating unknown encoding "booga" as latin-1.'):
         result = MessageSet.decode(self.high_characters, 'booga')
     self.assertEqual(self.high_characters.decode('latin-1'), result)
Exemplo n.º 6
0
 def test_decode_unknown_ascii(self):
     """Test decode with ascii characters in an unknown encoding."""
     result = MessageSet.decode('abcde', 'booga')
     self.assertEqual(u'abcde', result)
Exemplo n.º 7
0
 def test_decode_macintosh(self):
     """Test decode with macintosh encoding."""
     result = MessageSet.decode(self.high_characters, 'macintosh')
     self.assertEqual(self.high_characters.decode('macroman'), result)
Exemplo n.º 8
0
 def test_decode_utf8(self):
     """Test decode with a known encoding."""
     result = MessageSet.decode(u'\u1234'.encode('utf-8'), 'utf-8')
     self.assertEqual(u'\u1234', result)