Esempio n. 1
0
 def test_errMsg(self):
     """CharFilter errMsg should produce useful error message"""
     c = CharFilter('abc')
     d = CharFilter('abc', name='XYZ', invert_charset=True)
     #should automatically strip whitespace
     s2 = '  aceacef  '
     self.assertEqual(c.errMsg(s2), 
         "Filter 'None' found bad chars 'e,f' in input '  aceacef  '")
     self.assertEqual(d.errMsg(s2),
         "Filter 'XYZ' found bad chars 'a,c' in input '  aceacef  '")
Esempio n. 2
0
 def test_errMsg(self):
     """CharFilter errMsg should produce useful error message"""
     c = CharFilter('abc')
     d = CharFilter('abc', name='XYZ', invert_charset=True)
     #should automatically strip whitespace
     s2 = '  aceacef  '
     self.assertEqual(
         c.errMsg(s2),
         "Filter 'None' found bad chars 'e,f' in input '  aceacef  '")
     self.assertEqual(
         d.errMsg(s2),
         "Filter 'XYZ' found bad chars 'a,c' in input '  aceacef  '")
Esempio n. 3
0
 def test_resultAndError(self):
     """CharFilter resultAndError should return both result and error"""
     c = CharFilter('abc')
     s2 = '  aceacef  '
     self.assertEqual(c.resultAndError(s2), (c(s2), c.errMsg(s2)))
Esempio n. 4
0
 def test_resultAndError(self):
     """CharFilter resultAndError should return both result and error"""
     c = CharFilter('abc')
     s2 = '  aceacef  '
     self.assertEqual(c.resultAndError(s2), (c(s2), c.errMsg(s2)))