Skip to content

Commit af1a1dd

Browse files
authored
Merge pull request #103 from python-jsonschema/constrain-text
2 parents e393e2d + b2ca8ac commit af1a1dd

19 files changed

+339
-280
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
runs-on: ubuntu-latest
2727
strategy:
2828
matrix:
29-
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7", "pypy-3.8"]
29+
python-version: ["3.8", "3.9", "3.10", "3.11", "pypy-3.8", "pypy-3.9", "pypy-3.10"]
3030
fail-fast: false
3131
steps:
3232
- uses: actions/checkout@v2
@@ -47,7 +47,7 @@ jobs:
4747
runs-on: ubuntu-latest
4848
strategy:
4949
matrix:
50-
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7", "pypy-3.8"]
50+
python-version: ["3.8", "3.9", "3.10", "3.11", "pypy-3.8"] # , "pypy-3.9", "pypy-3.10"
5151
fail-fast: false
5252
steps:
5353
- uses: actions/checkout@v2

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
#### 0.23.0 - 2023-09-24
4+
- Add new `allow_x00=` and `codec=` arguments to `from_schema()`, so that you can
5+
control generated strings more precisely.
6+
- Require hypothesis 6.84+ and jsonschema 4.18+, to support new features and
7+
avoid deprecations.
8+
- Requires Python 3.8 or later (3.7 is end-of-life), tested on Python 3.11
9+
310
#### 0.22.1 - 2023-02-07
411
- Cache JSON Schema validators by their schema's JSON representation
512

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ def test_integers(value):
3333
def test_card_numbers(value):
3434
assert isinstance(value, str)
3535
assert re.match(r"^\d{4} \d{4} \d{4} \d{4}$", value)
36+
37+
38+
@given(from_schema({}, allow_x00=False, codec="utf-8").map(json.dumps))
39+
def test_card_numbers(payload):
40+
assert isinstance(payload, str)
41+
assert "\0" not in payload # use allow_x00=False to exclude null characters
42+
# If you want to restrict generated strings characters which are valid in
43+
# a specific character encoding, you can do that with the `codec=` argument.
44+
payload.encode(codec="utf-8")
3645
```
3746

3847
For more details on property-based testing and how to use or customise

deps/check.in

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
# Top-level dependencies for `tox -e check`
22
flake8
3-
flake8-2020
4-
flake8-bandit
5-
flake8-bugbear
6-
flake8-builtins
7-
flake8-comprehensions
8-
flake8-datetimez
9-
flake8-docstrings
10-
flake8-mutable
11-
# flake8-noqa # See https://github.com/JBKahn/flake8-print/issues/50
12-
flake8-print
13-
flake8-strftime
3+
ruff
144
mypy
15-
pep8-naming
165
shed

deps/check.txt

+29-110
Original file line numberDiff line numberDiff line change
@@ -1,145 +1,64 @@
11
#
2-
# This file is autogenerated by pip-compile with python 3.7
3-
# To update, run:
2+
# This file is autogenerated by pip-compile with Python 3.10
3+
# by the following command:
44
#
55
# pip-compile --output-file=deps/check.txt deps/check.in
66
#
7-
attrs==21.2.0
8-
# via flake8-bugbear
9-
autoflake==1.4
7+
autoflake==2.2.1
108
# via shed
11-
bandit==1.7.1
12-
# via flake8-bandit
13-
black==21.12b0
9+
black==23.9.0
1410
# via shed
15-
click==8.0.3
11+
click==8.1.7
1612
# via black
1713
com2ann==0.3.0
1814
# via shed
19-
colorama==0.4.4
20-
# via
21-
# bandit
22-
# click
23-
flake8==4.0.1
24-
# via
25-
# -r deps/check.in
26-
# flake8-2020
27-
# flake8-bandit
28-
# flake8-bugbear
29-
# flake8-builtins
30-
# flake8-comprehensions
31-
# flake8-datetimez
32-
# flake8-docstrings
33-
# flake8-helper
34-
# flake8-mutable
35-
# flake8-polyfill
36-
# flake8-print
37-
# flake8-strftime
38-
# pep8-naming
39-
flake8-2020==1.6.1
40-
# via -r deps/check.in
41-
flake8-bandit==2.1.2
42-
# via -r deps/check.in
43-
flake8-bugbear==21.11.29
44-
# via -r deps/check.in
45-
flake8-builtins==1.5.3
46-
# via -r deps/check.in
47-
flake8-comprehensions==3.7.0
48-
# via -r deps/check.in
49-
flake8-datetimez==20.10.0
15+
flake8==6.1.0
5016
# via -r deps/check.in
51-
flake8-docstrings==1.6.0
52-
# via -r deps/check.in
53-
flake8-helper==0.2.0
54-
# via flake8-strftime
55-
flake8-mutable==1.2.0
56-
# via -r deps/check.in
57-
flake8-polyfill==1.0.2
58-
# via
59-
# flake8-bandit
60-
# pep8-naming
61-
flake8-print==4.0.0
62-
# via -r deps/check.in
63-
flake8-strftime==0.3.2
64-
# via -r deps/check.in
65-
gitdb==4.0.9
66-
# via gitpython
67-
gitpython==3.1.24
68-
# via bandit
69-
importlib-metadata==4.2.0
70-
# via
71-
# click
72-
# flake8
73-
# flake8-2020
74-
# flake8-comprehensions
75-
# stevedore
76-
isort==5.10.1
17+
isort==5.12.0
7718
# via shed
78-
libcst==0.3.23
19+
libcst==1.0.1
7920
# via shed
80-
mccabe==0.6.1
21+
mccabe==0.7.0
8122
# via flake8
82-
mypy==0.910
23+
mypy==1.5.1
8324
# via -r deps/check.in
84-
mypy-extensions==0.4.3
25+
mypy-extensions==1.0.0
8526
# via
8627
# black
8728
# mypy
8829
# typing-inspect
89-
pathspec==0.9.0
30+
packaging==23.1
9031
# via black
91-
pbr==5.8.0
92-
# via stevedore
93-
pep8-naming==0.12.1
94-
# via -r deps/check.in
95-
platformdirs==2.4.0
32+
pathspec==0.11.2
9633
# via black
97-
pycodestyle==2.8.0
98-
# via
99-
# flake8
100-
# flake8-bandit
101-
# flake8-print
102-
pydocstyle==6.1.1
103-
# via flake8-docstrings
104-
pyflakes==2.4.0
34+
platformdirs==3.10.0
35+
# via black
36+
pycodestyle==2.11.0
37+
# via flake8
38+
pyflakes==3.1.0
10539
# via
10640
# autoflake
10741
# flake8
108-
pyupgrade==2.29.1
42+
pyupgrade==3.10.1
10943
# via shed
110-
pyyaml==6.0
111-
# via
112-
# bandit
113-
# libcst
114-
shed==0.5.3
44+
pyyaml==6.0.1
45+
# via libcst
46+
ruff==0.0.287
11547
# via -r deps/check.in
116-
six==1.16.0
117-
# via flake8-print
118-
smmap==5.0.0
119-
# via gitdb
120-
snowballstemmer==2.2.0
121-
# via pydocstyle
122-
stevedore==3.5.0
123-
# via bandit
124-
tokenize-rt==4.2.1
48+
shed==2023.6.1
49+
# via -r deps/check.in
50+
tokenize-rt==5.2.0
12551
# via pyupgrade
126-
toml==0.10.2
127-
# via mypy
128-
tomli==1.2.3
129-
# via black
130-
typed-ast==1.4.3
52+
tomli==2.0.1
13153
# via
54+
# autoflake
13255
# black
13356
# mypy
134-
typing-extensions==4.0.1
57+
typing-extensions==4.7.1
13558
# via
13659
# black
137-
# gitpython
138-
# importlib-metadata
13960
# libcst
14061
# mypy
14162
# typing-inspect
142-
typing-inspect==0.7.1
63+
typing-inspect==0.9.0
14364
# via libcst
144-
zipp==3.6.0
145-
# via importlib-metadata

deps/test.txt

+36-54
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,80 @@
11
#
2-
# This file is autogenerated by pip-compile with python 3.7
3-
# To update, run:
2+
# This file is autogenerated by pip-compile with Python 3.10
3+
# by the following command:
44
#
55
# pip-compile --output-file=deps/test.txt deps/test.in setup.py
66
#
7-
arrow==1.2.1
7+
arrow==1.2.3
88
# via isoduration
9-
atomicwrites==1.4.0
10-
# via pytest
11-
attrs==21.2.0
9+
attrs==23.1.0
1210
# via
1311
# hypothesis
1412
# jsonschema
15-
# pytest
16-
cached-property==1.5.2
17-
# via fqdn
18-
colorama==0.4.4
19-
# via pytest
20-
coverage[toml]==6.2
13+
# referencing
14+
coverage[toml]==7.3.1
2115
# via pytest-cov
22-
execnet==1.9.0
16+
exceptiongroup==1.1.3
17+
# via
18+
# hypothesis
19+
# pytest
20+
execnet==2.0.2
2321
# via pytest-xdist
2422
fqdn==1.5.1
2523
# via jsonschema
26-
hypothesis==6.31.6
24+
hypothesis==6.84.3
2725
# via hypothesis-jsonschema (setup.py)
28-
idna==3.3
26+
idna==3.4
2927
# via jsonschema
30-
importlib-metadata==4.8.2
31-
# via
32-
# jsonschema
33-
# pluggy
34-
# pytest
35-
importlib-resources==5.4.0
36-
# via jsonschema
37-
iniconfig==1.1.1
28+
iniconfig==2.0.0
3829
# via pytest
3930
isoduration==20.11.0
4031
# via jsonschema
41-
jsonpointer==2.2
32+
jsonpointer==2.4
4233
# via jsonschema
43-
jsonschema[format]==4.2.1
34+
jsonschema[format]==4.19.0
4435
# via
4536
# -r deps/test.in
4637
# hypothesis-jsonschema (setup.py)
47-
packaging==21.3
38+
jsonschema-specifications==2023.7.1
39+
# via jsonschema
40+
packaging==23.1
4841
# via pytest
49-
pluggy==1.0.0
42+
pluggy==1.3.0
5043
# via pytest
51-
py==1.11.0
52-
# via
53-
# pytest
54-
# pytest-forked
55-
pyparsing==3.0.6
56-
# via packaging
57-
pyrsistent==0.18.0
58-
# via jsonschema
59-
pytest==6.2.5
44+
pytest==7.4.2
6045
# via
6146
# -r deps/test.in
6247
# pytest-cov
63-
# pytest-forked
6448
# pytest-xdist
65-
pytest-cov==3.0.0
49+
pytest-cov==4.1.0
6650
# via -r deps/test.in
67-
pytest-forked==1.4.0
68-
# via pytest-xdist
69-
pytest-xdist==2.5.0
51+
pytest-xdist==3.3.1
7052
# via -r deps/test.in
7153
python-dateutil==2.8.2
7254
# via arrow
55+
referencing==0.30.2
56+
# via
57+
# jsonschema
58+
# jsonschema-specifications
7359
rfc3339-validator==0.1.4
7460
# via jsonschema
7561
rfc3987==1.3.8
7662
# via jsonschema
63+
rpds-py==0.10.2
64+
# via
65+
# jsonschema
66+
# referencing
7767
six==1.16.0
7868
# via
7969
# python-dateutil
8070
# rfc3339-validator
8171
sortedcontainers==2.4.0
8272
# via hypothesis
83-
toml==0.10.2
84-
# via pytest
85-
tomli==2.0.0
86-
# via coverage
87-
typing-extensions==4.0.1
73+
tomli==2.0.1
8874
# via
89-
# arrow
90-
# importlib-metadata
91-
uri-template==1.1.0
75+
# coverage
76+
# pytest
77+
uri-template==1.3.0
9278
# via jsonschema
93-
webcolors==1.11.1
79+
webcolors==1.13
9480
# via jsonschema
95-
zipp==3.6.0
96-
# via
97-
# importlib-metadata
98-
# importlib-resources

0 commit comments

Comments
 (0)