-
-
Notifications
You must be signed in to change notification settings - Fork 610
Closed
Labels
BugSomething doesn't work the way it should.Something doesn't work the way it should.
Description
Recent update 3.1.0 introduces a breaking change for Python 2.7.
Here is a code sample that works with 3.0.0 but is broken with 3.1.0 because of the switch from re to js_regex: #609
from jsonschema import Draft4Validator as Validator
schema = {'type': 'string', 'pattern': r'\d+'}
validator = Validator(schema)
list(validator.iter_errors('123'))Thrown exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/jsonschema/validators.py", line 328, in iter_errors
for error in errors:
File "/usr/local/lib/python2.7/site-packages/jsonschema/_validators.py", line 200, in pattern
not js_regex.compile(patrn).search(instance)
File "/usr/local/lib/python2.7/site-packages/js_regex/_impl.py", line 39, in compile
raise TypeError("pattern={!r} must be a unicode string".format(pattern))
TypeError: pattern='\\d+' must be a unicode string
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugSomething doesn't work the way it should.Something doesn't work the way it should.