-
Notifications
You must be signed in to change notification settings - Fork 292
Closed
Labels
Description
When building pydantic-code for Fedora Linux with Python 3.13.0a3, one of the tests fails.
re.Error has been renamed to PatternError: https://docs.python.org/dev/whatsnew/3.13.html#re
________________________ test_invalid_regex[python-re] _________________________
engine = 'python-re'
@pytest.mark.parametrize('engine', [None, 'rust-regex', 'python-re'])
def test_invalid_regex(engine):
# TODO uncomment and fix once #150 is done
# with pytest.raises(SchemaError) as exc_info:
# SchemaValidator({'type': 'str', 'pattern': 123})
# assert exc_info.value.args[0] == (
# 'Error building "str" validator:\n TypeError: \'int\' object cannot be converted to \'PyString\''
# )
with pytest.raises(SchemaError) as exc_info:
SchemaValidator(core_schema.str_schema(pattern='(abc', regex_engine=engine))
if engine is None or engine == 'rust-regex':
assert exc_info.value.args[0] == (
'Error building "str" validator:\n'
' SchemaError: regex parse error:\n'
' (abc\n'
' ^\n'
'error: unclosed group'
)
elif engine == 'python-re':
> assert exc_info.value.args[0] == (
'Error building "str" validator:\n error: missing ), unterminated subpattern at position 0'
)
E assert 'Error buildi...at position 0' == 'Error buildi...at position 0'
E Error building "str" validator:
E - error: missing ), unterminated subpattern at position 0
E + PatternError: missing ), unterminated subpattern at position 0
E ? ++++ +++
tests/validators/test_string.py:190: AssertionError
=========================== short test summary info ============================