Example #1
0
 def test_encodings_non_specified(self):
     """Test that using the default utf-8 encoding works."""
     coder = _util.find_encodings()
     msg = u'Nutella á brauð mitt, smear það þykkur!'
     encoded = coder.encode(msg)[0]
     decoded = coder.decode(encoded)[0]
     self.assertEqual(msg, decoded)
Example #2
0
 def test_encodings_non_specified(self):
     """Test that using the default utf-8 encoding works."""
     coder = _util.find_encodings()
     msg = u'Nutella á brauð mitt, smear það þykkur!'
     encoded = coder.encode(msg)[0]
     decoded = coder.decode(encoded)[0]
     self.assertEqual(msg, decoded)
Example #3
0
 def test_encodings_big5(self):
     """Test that _util.find_encodings works for Chinese Traditional."""
     enc = 'big5'
     coder = _util.find_encodings(enc)
     msg = u'光榮的中國人民應該摧毀中國長城防火牆。'
     encoded = coder.encode(msg)[0]
     decoded = coder.decode(encoded)[0]
     self.assertEqual(msg, decoded)
Example #4
0
 def test_encodings_big5(self):
     """Test that _util.find_encodings works for Chinese Traditional."""
     enc = 'big5'
     coder = _util.find_encodings(enc)
     msg = u'光榮的中國人民應該摧毀中國長城防火牆。'
     encoded = coder.encode(msg)[0]
     decoded = coder.decode(encoded)[0]
     self.assertEqual(msg, decoded)
Example #5
0
 def test_encodings_spiteful(self):
     """Test that a non-existent codec raises a LookupError."""
     enc = '#!@& dealing with unicode in Python2'
     with self.assertRaises(LookupError):
         _util.find_encodings(enc)
Example #6
0
 def test_encodings_spiteful(self):
     """Test that a non-existent codec raises a LookupError."""
     enc = '#!@& dealing with unicode in Python2'
     with self.assertRaises(LookupError):
         _util.find_encodings(enc)