A validator to validate the length of given value whether less than min_length or not.
| 49 | |
| 50 | |
| 51 | class MinLengthValidator(Validator): |
| 52 | """ |
| 53 | A validator to validate the length of given value whether less than min_length or not. |
| 54 | """ |
| 55 | |
| 56 | def __init__(self, min_length: int) -> None: |
| 57 | self.min_length = min_length |
| 58 | |
| 59 | def __call__(self, value: str) -> None: |
| 60 | if value is None: |
| 61 | raise ValidationError("Value must not be None") |
| 62 | if len(value) < self.min_length: |
| 63 | raise ValidationError(f"Length of '{value}' {len(value)} < {self.min_length}") |
| 64 | |
| 65 | |
| 66 | class NumericValidator(Validator): |
no outgoing calls
no test coverage detected
searching dependent graphs…