Skip to content

Commit ffcbebd

Browse files
committed
Merge remote-tracking branch 'origin/master' into fix_issue669
* origin/master: Handle multipleOf overflow Don't fail when codecov.io flakes. pep517.build is dead or dying. Temporarily skip the failing tests for python-jsonschema#743. Sigh, ugly, but assrtRegexpMatches is deprecated. Squashed 'json/' changes from 21555a85..96742ba3 Squashed 'json/' changes from fce9e9b3..21555a85 Whoops, send coverage to codecov again. Be able to run coverage on all toxenvs. Remove outdated release notes. Use the longer form of the CLI option for clarity. Bump doc requirements (via pip-compile) Remove the Py2 coding declaration. Run pre-commit in CI. Remove docformatter, it's too unwieldy. Minor doc formatting. Sigh, this appears to be a regex, not exact match, so it was ignoring everything. Update pre-commit hooks.
2 parents 1bfbb90 + e48d56c commit ffcbebd

35 files changed

+311
-155
lines changed

.github/workflows/coverage.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
- name: Install tox
2121
run: python -m pip install tox
2222
- name: Collect & Upload Coverage
23-
run: python -m tox -e codecov
23+
# codecov.io is too flaky to fail for this right now
24+
continue-on-error: true
25+
run: python -m tox -e pypy3-format-codecov
2426
env:
2527
CODECOV_TOKEN: 2b38dae1-41c4-4435-a29d-79a1299e5617

.github/workflows/packaging.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@ jobs:
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install dependencies
23-
run: python -m pip install pep517
24-
- name: Evade 'pypa/pep517#74'
25-
run: python -m pip install -U setuptools setuptools-scm pip wheel
26-
if: startsWith(matrix.python-version, 'pypy')
23+
run: python -m pip install build
2724
- name: Create packages
28-
run: python -m pep517.build .
25+
run: python -m build .
2926
- uses: actions/upload-artifact@master
3027
with:
3128
name: dist-${{ matrix.os }}-${{ matrix.python-version }}

.github/workflows/pre-commit.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
pre-commit:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-python@v2
13+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
exclude: json
1+
exclude: json/
22

33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -14,14 +14,6 @@ repos:
1414
- id: end-of-file-fixer
1515
- id: trailing-whitespace
1616
- repo: https://github.com/timothycrosley/isort
17-
rev: 5.3.2
17+
rev: 5.4.2
1818
hooks:
1919
- id: isort
20-
- repo: https://github.com/myint/docformatter
21-
rev: v1.3.1
22-
hooks:
23-
- id: docformatter
24-
args:
25-
- --in-place
26-
- --pre-summary-newline
27-
- --make-summary-multi-line

README.rst

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ It can also be used from console:
5151

5252
.. code-block:: bash
5353
54-
$ jsonschema -i sample.json sample.schema
54+
$ jsonschema --instance sample.json sample.schema
5555
5656
Features
5757
--------
@@ -80,15 +80,6 @@ Installation
8080
$ pip install jsonschema
8181
8282
83-
Release Notes
84-
-------------
85-
86-
v3.1 brings support for ECMA 262 dialect regular expressions
87-
throughout schemas, as recommended by the specification. Big
88-
thanks to @Zac-HD for authoring support in a new `js-regex
89-
<https://pypi.org/project/js-regex/>`_ library.
90-
91-
9283
Running the Test Suite
9384
----------------------
9485

docs/conf.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
3-
# This file is execfile()d with the current directory set to its containing dir.
4-
51
from textwrap import dedent
62
import os
73
import re

docs/requirements.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@
66
#
77
alabaster==0.7.12 # via sphinx
88
babel==2.8.0 # via sphinx
9-
certifi==2020.4.5.1 # via requests
9+
certifi==2020.6.20 # via requests
1010
chardet==3.0.4 # via requests
1111
docutils==0.16 # via sphinx
12-
idna==2.9 # via requests
12+
idna==2.10 # via requests
1313
imagesize==1.2.0 # via sphinx
1414
jinja2==2.11.2 # via sphinx
15-
lxml==4.5.0 # via -r requirements.in
15+
lxml==4.5.2 # via -r requirements.in
1616
markupsafe==1.1.1 # via jinja2
17-
packaging==20.3 # via sphinx
18-
pyenchant==3.0.1 # via sphinxcontrib-spelling
17+
packaging==20.4 # via sphinx
18+
pyenchant==3.1.1 # via sphinxcontrib-spelling
1919
pygments==2.6.1 # via sphinx
2020
pyparsing==2.4.7 # via packaging
2121
pytz==2020.1 # via babel
22-
requests==2.23.0 # via sphinx
23-
six==1.14.0 # via packaging, sphinxcontrib-spelling
22+
requests==2.24.0 # via sphinx
23+
six==1.15.0 # via packaging
2424
snowballstemmer==2.0.0 # via sphinx
25-
sphinx==3.0.3 # via -r requirements.in, sphinxcontrib-spelling
25+
sphinx==3.2.1 # via -r requirements.in, sphinxcontrib-spelling
2626
sphinxcontrib-applehelp==1.0.2 # via sphinx
2727
sphinxcontrib-devhelp==1.0.2 # via sphinx
2828
sphinxcontrib-htmlhelp==1.0.3 # via sphinx
2929
sphinxcontrib-jsmath==1.0.1 # via sphinx
3030
sphinxcontrib-qthelp==1.0.3 # via sphinx
3131
sphinxcontrib-serializinghtml==1.1.4 # via sphinx
32-
sphinxcontrib-spelling==5.0.0 # via -r requirements.in
33-
urllib3==1.25.9 # via requests
32+
sphinxcontrib-spelling==5.3.0 # via -r requirements.in
33+
urllib3==1.25.10 # via requests
3434

3535
# The following packages are considered to be unsafe in a requirements file:
3636
# setuptools

json/tests/draft2019-09/enum.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@
3333
"description": "objects are deep compared",
3434
"data": {"foo": false},
3535
"valid": false
36+
},
37+
{
38+
"description": "valid object matches",
39+
"data": {"foo": 12},
40+
"valid": true
41+
},
42+
{
43+
"description": "extra properties in object is invalid",
44+
"data": {"foo": 12, "boo": 42},
45+
"valid": false
3646
}
3747
]
3848
},

json/tests/draft2019-09/if-then-else.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,5 +224,35 @@
224224
"valid": true
225225
}
226226
]
227+
},
228+
{
229+
"description": "if appears at the end when serialized (keyword processing sequence)",
230+
"schema": {
231+
"then": { "const": "yes" },
232+
"else": { "const": "other" },
233+
"if": { "maxLength": 4 }
234+
},
235+
"tests": [
236+
{
237+
"description": "yes redirects to then and passes",
238+
"data": "yes",
239+
"valid": true
240+
},
241+
{
242+
"description": "other redirects to else and passes",
243+
"data": "other",
244+
"valid": true
245+
},
246+
{
247+
"description": "no redirects to then and fails",
248+
"data": "no",
249+
"valid": false
250+
},
251+
{
252+
"description": "invalid redirects to else and fails",
253+
"data": "invalid",
254+
"valid": false
255+
}
256+
]
227257
}
228258
]

json/tests/draft2019-09/multipleOf.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,16 @@
5656
"valid": false
5757
}
5858
]
59+
},
60+
{
61+
"description": "invalid instance should not raise error when float division = inf",
62+
"schema": {"type": "integer", "multipleOf": 0.123456789},
63+
"tests": [
64+
{
65+
"description": "always invalid, but naive implementations may raise an overflow error",
66+
"data": 1e308,
67+
"valid": false
68+
}
69+
]
5970
}
6071
]

json/tests/draft2019-09/optional/ecmascript-regex.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
[
2-
{
3-
"description": "ECMA 262 regex non-compliance",
4-
"schema": { "format": "regex" },
5-
"tests": [
6-
{
7-
"description": "ECMA 262 has no support for \\Z anchor from .NET",
8-
"data": "^\\S(|(.|\\n)*\\S)\\Z",
9-
"valid": false
10-
}
11-
]
12-
},
132
{
143
"description": "ECMA 262 regex $ does not match trailing newline",
154
"schema": {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{
3+
"description": "all integers are multiples of 0.5, if overflow is handled",
4+
"schema": {"type": "integer", "multipleOf": 0.5},
5+
"tests": [
6+
{
7+
"description": "valid if optional overflow handling is implemented",
8+
"data": 1e308,
9+
"valid": true
10+
}
11+
]
12+
}
13+
]

json/tests/draft2019-09/unevaluatedItems.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@
8787
},
8888
"tests": [
8989
{
90-
"description": "with no unevaluted items",
90+
"description": "with no unevaluated items",
9191
"data": ["foo"],
9292
"valid": true
9393
},
9494
{
95-
"description": "with unevaluted items",
95+
"description": "with unevaluated items",
9696
"data": ["foo", "bar"],
9797
"valid": false
9898
}
@@ -135,12 +135,12 @@
135135
},
136136
"tests": [
137137
{
138-
"description": "with no unevaluted items",
138+
"description": "with no unevaluated items",
139139
"data": ["foo", 42],
140140
"valid": true
141141
},
142142
{
143-
"description": "with unevaluted items",
143+
"description": "with unevaluated items",
144144
"data": ["foo", 42, true],
145145
"valid": false
146146
}
@@ -228,22 +228,22 @@
228228
},
229229
"tests": [
230230
{
231-
"description": "when one schema matches and has no unevaluted items",
231+
"description": "when one schema matches and has no unevaluated items",
232232
"data": ["foo", "bar"],
233233
"valid": true
234234
},
235235
{
236-
"description": "when one schema matches and has unevaluted items",
236+
"description": "when one schema matches and has unevaluated items",
237237
"data": ["foo", "bar", 42],
238238
"valid": false
239239
},
240240
{
241-
"description": "when two schemas match and has no unevaluted items",
241+
"description": "when two schemas match and has no unevaluated items",
242242
"data": ["foo", "bar", "baz"],
243243
"valid": true
244244
},
245245
{
246-
"description": "when two schemas match and has unevaluted items",
246+
"description": "when two schemas match and has unevaluated items",
247247
"data": ["foo", "bar", "baz", 42],
248248
"valid": false
249249
}
@@ -274,12 +274,12 @@
274274
},
275275
"tests": [
276276
{
277-
"description": "with no unevaluted items",
277+
"description": "with no unevaluated items",
278278
"data": ["foo", "bar"],
279279
"valid": true
280280
},
281281
{
282-
"description": "with unevaluted items",
282+
"description": "with unevaluated items",
283283
"data": ["foo", "bar", 42],
284284
"valid": false
285285
}
@@ -304,7 +304,7 @@
304304
},
305305
"tests": [
306306
{
307-
"description": "with unevaluted items",
307+
"description": "with unevaluated items",
308308
"data": ["foo", "bar"],
309309
"valid": false
310310
}
@@ -342,22 +342,22 @@
342342
},
343343
"tests": [
344344
{
345-
"description": "when if matches and it has no unevaluted items",
345+
"description": "when if matches and it has no unevaluated items",
346346
"data": ["foo", "bar", "then"],
347347
"valid": true
348348
},
349349
{
350-
"description": "when if matches and it has unevaluted items",
350+
"description": "when if matches and it has unevaluated items",
351351
"data": ["foo", "bar", "then", "else"],
352352
"valid": false
353353
},
354354
{
355-
"description": "when if doesn't match and it has no unevaluted items",
355+
"description": "when if doesn't match and it has no unevaluated items",
356356
"data": ["foo", 42, 42, "else"],
357357
"valid": true
358358
},
359359
{
360-
"description": "when if doesn't match and it has unevaluted items",
360+
"description": "when if doesn't match and it has unevaluated items",
361361
"data": ["foo", 42, 42, "else", 42],
362362
"valid": false
363363
}

json/tests/draft3/ref.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,15 @@
7575
{
7676
"description": "escaped pointer ref",
7777
"schema": {
78-
"tilde~field": {"type": "integer"},
79-
"slash/field": {"type": "integer"},
80-
"percent%field": {"type": "integer"},
78+
"definitions": {
79+
"tilde~field": {"type": "integer"},
80+
"slash/field": {"type": "integer"},
81+
"percent%field": {"type": "integer"}
82+
},
8183
"properties": {
82-
"tilde": {"$ref": "#/tilde~0field"},
83-
"slash": {"$ref": "#/slash~1field"},
84-
"percent": {"$ref": "#/percent%25field"}
84+
"tilde": {"$ref": "#/definitions/tilde~0field"},
85+
"slash": {"$ref": "#/definitions/slash~1field"},
86+
"percent": {"$ref": "#/definitions/percent%25field"}
8587
}
8688
},
8789
"tests": [

json/tests/draft4/enum.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@
3333
"description": "objects are deep compared",
3434
"data": {"foo": false},
3535
"valid": false
36+
},
37+
{
38+
"description": "valid object matches",
39+
"data": {"foo": 12},
40+
"valid": true
41+
},
42+
{
43+
"description": "extra properties in object is invalid",
44+
"data": {"foo": 12, "boo": 42},
45+
"valid": false
3646
}
3747
]
3848
},

json/tests/draft4/multipleOf.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,16 @@
5656
"valid": false
5757
}
5858
]
59+
},
60+
{
61+
"description": "invalid instance should not raise error when float division = inf",
62+
"schema": {"type": "integer", "multipleOf": 0.123456789},
63+
"tests": [
64+
{
65+
"description": "always invalid, but naive implementations may raise an overflow error",
66+
"data": 1e308,
67+
"valid": false
68+
}
69+
]
5970
}
6071
]

0 commit comments

Comments
 (0)