Example #1
0
 def _validate_positive_integer(self, attribute_name):
     if utils.parse_int(self[attribute_name]) < 0:
         self._add_error(attribute_name,
                         _("%s should be a positive integer")
                         % attribute_name)
Example #2
0
 def test_converts_valid_integer_string_to_int(self):
     self.assertEqual(utils.parse_int("123"), 123)
Example #3
0
 def _validate_positive_integer(self, attribute_name):
     if utils.parse_int(self[attribute_name]) < 0:
         self._add_error(attribute_name,
                         _("%s should be a positive integer")
                           % attribute_name)
Example #4
0
 def test_converts_none_to_none(self):
     self.assertEqual(utils.parse_int(None), None)
Example #5
0
 def test_converts_invalid_int_to_none(self):
     self.assertEqual(utils.parse_int("a2z"), None)
Example #6
0
 def test_converts_valid_integer_string_to_int(self):
     self.assertEqual(utils.parse_int("123"), 123)
Example #7
0
 def test_converts_none_to_none(self):
     self.assertEqual(utils.parse_int(None), None)
Example #8
0
 def test_converts_invalid_int_to_none(self):
     self.assertEqual(utils.parse_int("a2z"), None)