def test_fail(self): with self.assertRaises(ValidationError): MinValueOrNoneValidator(0)(-1) with self.assertRaises(ValidationError): MinValueOrNoneValidator(100)(0)
def test_both_none(self): self.assertIsNone(MinValueOrNoneValidator(None)(None))
def test_integer_bound_none_value(self): self.assertIsNone(MinValueOrNoneValidator(-100)(None)) self.assertIsNone(MinValueOrNoneValidator(0)(None)) self.assertIsNone(MinValueOrNoneValidator(100)(None))
def test_none_bound_integer_value(self): self.assertIsNone(MinValueOrNoneValidator(None)(-100)) self.assertIsNone(MinValueOrNoneValidator(None)(0)) self.assertIsNone(MinValueOrNoneValidator(None)(100))
def test_both_integers(self): self.assertIsNone(MinValueOrNoneValidator(-1)(100)) self.assertIsNone(MinValueOrNoneValidator(0)(0)) self.assertIsNone(MinValueOrNoneValidator(100)(100))