Skip to content

Commit

Permalink
check compiled pattern uses flags in test
Browse files Browse the repository at this point in the history
  • Loading branch information
sydney-runkle committed Jun 11, 2024
1 parent 2ad5724 commit 4555a1a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/validators/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,10 @@ def test_coerce_numbers_to_str_schema_with_strict_mode(number: int):
v.validate_python(number)
with pytest.raises(ValidationError):
v.validate_json(str(number))


@pytest.mark.parametrize('engine', [None, 'rust-regex', 'python-re'])
def test_compiled_regex(engine) -> None:
v = SchemaValidator(core_schema.str_schema(pattern=re.compile('abc', re.IGNORECASE), regex_engine=engine))
assert v.validate_python('abc') == 'abc'
assert v.validate_python('ABC') == 'ABC'

0 comments on commit 4555a1a

Please sign in to comment.