예제 #1
0
 def test_positive_integer_raises_ValueError(self, mocked_int):
     mocked_int.return_value = -1
     with self.assertRaises(ValueError):
         validatorfuncs.positive_integer(str(-1))
     for pi in ["", "000", "abc", "-1"]:
         mocked_int.side_effect = ValueError
         with self.assertRaises(ValueError):
             validatorfuncs.positive_integer(pi)
예제 #2
0
 def validate(self, value, **kwargs):
     return validatorfuncs.positive_integer(value,
                                            option_key=self.key,
                                            **kwargs)
예제 #3
0
 def test_positive_integer_ok(self):
     for pi in ["123", "4567890", "001"]:
         self.assertEqual(int(pi), validatorfuncs.positive_integer(pi))
예제 #4
0
 def test_positive_integer_ok(self):
     for pi in ['123', '4567890', '001']:
         self.assertEqual(int(pi), validatorfuncs.positive_integer(pi))