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)
def test_converts_valid_integer_string_to_int(self): self.assertEqual(utils.parse_int("123"), 123)
def test_converts_none_to_none(self): self.assertEqual(utils.parse_int(None), None)
def test_converts_invalid_int_to_none(self): self.assertEqual(utils.parse_int("a2z"), None)