Skip to content

Commit

Permalink
[pre-commit.ci lite] apply automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci-lite[bot] authored Nov 22, 2024
1 parent b036194 commit 807fe8e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/wtforms/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class ValidatorSetupError(ValueError):
"""
Raised when a validator is configured improperly.
"""

def __init__(self, message="", *args, **kwargs):
ValueError.__init__(self, message, *args, **kwargs)

Expand Down Expand Up @@ -366,7 +367,9 @@ def __init__(self, regex, flags=0, message=None, mode="match"):
def _validate_mode(self, mode):
if mode not in self._supported_modes:
raise ValidatorSetupError(
"Invalid regexp mode. Supported values: {}".format(", ".join(self._supported_modes))
"Invalid regexp mode. Supported values: {}".format(
", ".join(self._supported_modes)
)
)
return mode

Expand Down
5 changes: 3 additions & 2 deletions tests/validators/test_regexp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import pytest

from wtforms.validators import regexp, ValidatorSetupError
from wtforms.validators import regexp
from wtforms.validators import ValidationError
from wtforms.validators import ValidatorSetupError


def grab_error_message(callable, form, field):
Expand Down Expand Up @@ -232,7 +233,7 @@ def test_regexp_message(dummy_form, dummy_field):
[],
{},
(),
]
],
)
def test_regex_invalid_mode(dummy_form, dummy_field, re_mode):
"""
Expand Down

0 comments on commit 807fe8e

Please sign in to comment.