Max value validator for FloatField, IntField, SmallIntField, BigIntField
| 87 | |
| 88 | |
| 89 | class MaxValueValidator(NumericValidator): |
| 90 | """ |
| 91 | Max value validator for FloatField, IntField, SmallIntField, BigIntField |
| 92 | """ |
| 93 | |
| 94 | def __init__(self, max_value: int | float | Decimal) -> None: |
| 95 | self._validate_type(max_value) |
| 96 | self.max_value = max_value |
| 97 | |
| 98 | def __call__(self, value: int | float | Decimal) -> None: |
| 99 | self._validate_type(value) |
| 100 | if value > self.max_value: |
| 101 | raise ValidationError(f"Value should be less or equal to {self.max_value}") |
| 102 | |
| 103 | |
| 104 | class CommaSeparatedIntegerListValidator(Validator): |
no outgoing calls
no test coverage detected
searching dependent graphs…