• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LeanderCS / flask-inputfilter / #389

24 May 2025 01:01PM UTC coverage: 93.409% (-0.2%) from 93.644%
#389

Pull #56

coveralls-python

LeanderCS
48 | Remove typing_extensions dep
Pull Request #56: 48 | Update ArrayElementValidator and IsDataclassValidator

64 of 73 new or added lines in 4 files covered. (87.67%)

87 existing lines in 18 files now uncovered.

1885 of 2018 relevant lines covered (93.41%)

0.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.31
/flask_inputfilter/validators/is_lowercase_validator.py
1
from __future__ import annotations
1✔
2

3
from typing import Any, Optional
1✔
4

5
from flask_inputfilter.exceptions import ValidationError
1✔
6
from flask_inputfilter.validators import BaseValidator
1✔
7

8

9
class IsLowercaseValidator(BaseValidator):
1✔
10
    """
11
    Checks if a value is entirely lowercase. The validator ensures
12
    that the input string has no uppercase characters.
13

14
    **Parameters:**
15

16
    - **error_message** (*Optional[str]*): Custom error message if the value is not entirely lowercase.
17

18
    **Expected Behavior:**
19

20
    Confirms that the input is a string and verifies that all characters are lowercase using the string method ``islower()``. Raises a ``ValidationError`` if the check fails.
21

22
    **Example Usage:**
23

24
    .. code-block:: python
25

26
        class LowercaseInputFilter(InputFilter):
27
            def __init__(self):
28
                super().__init__()
29
                self.add('username', validators=[
30
                    IsLowercaseValidator()
31
                ])
32
    """
33

34
    __slots__ = ("error_message",)
1✔
35

36
    def __init__(self, error_message: Optional[str] = None) -> None:
1✔
37
        self.error_message = (
1✔
38
            error_message or "Value is not entirely lowercase."
39
        )
40

41
    def validate(self, value: Any) -> None:
1✔
42
        if not isinstance(value, str):
1✔
UNCOV
43
            raise ValidationError("Value must be a string.")
×
44
        if not value.islower():
1✔
45
            raise ValidationError(self.error_message)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc