Exemplo n.º 1
0
 def test_wrong_format_input_raises(self):
     with self.assertRaises(ValueError):
         _ew.decode('=?badone?=')
     with self.assertRaises(ValueError):
         _ew.decode('=?')
     with self.assertRaises(ValueError):
         _ew.decode('')
     with self.assertRaises(KeyError):
         _ew.decode('=?utf-8?X?somevalue?=')
 def test_wrong_format_input_raises(self):
     with self.assertRaises(ValueError):
         _ew.decode('=?badone?=')
     with self.assertRaises(ValueError):
         _ew.decode('=?')
     with self.assertRaises(ValueError):
         _ew.decode('')
 def _test(self, source, result, charset='us-ascii', lang='', defects=[]):
     res, char, l, d = _ew.decode(source)
     self.assertEqual(res, result)
     self.assertEqual(char, charset)
     self.assertEqual(l, lang)
     self.assertDefectsEqual(d, defects)
 def _test(self, source, result, charset='us-ascii', lang='', defects=[]):
     res, char, l, d = _ew.decode(source)
     self.assertEqual(res, result)
     self.assertEqual(char, charset)
     self.assertEqual(l, lang)
     self.assertDefectsEqual(d, defects)