Skip to content

Commit 6b3f22e

Browse files
committed
Merge commit 'aaf8e3125211f6fcda17b0a47e54a74c362202b7'
* commit 'aaf8e3125211f6fcda17b0a47e54a74c362202b7': Squashed 'json/' changes from 20fb14bde..3731ed32a
2 parents eed6d8b + aaf8e31 commit 6b3f22e

File tree

6 files changed

+227
-4
lines changed

6 files changed

+227
-4
lines changed

json/bin/jsonschema_suite

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#! /usr/bin/env python3
2-
from pprint import pformat
32
import argparse
43
import errno
54
import fnmatch
@@ -12,9 +11,6 @@ import textwrap
1211
import unittest
1312
import warnings
1413

15-
if getattr(unittest, "skipIf", None) is None:
16-
unittest.skipIf = lambda cond, msg : lambda fn : fn
17-
1814
try:
1915
import jsonschema.validators
2016
except ImportError:
@@ -32,25 +28,37 @@ with open(os.path.join(ROOT_DIR, "test-schema.json")) as schema:
3228

3329

3430
def files(paths):
31+
"""
32+
Each test file in the provided paths.
33+
"""
3534
for path in paths:
3635
with open(path) as test_file:
3736
yield json.load(test_file)
3837

3938

4039
def groups(paths):
40+
"""
41+
Each test group within each file in the provided paths.
42+
"""
4143
for test_file in files(paths):
4244
for group in test_file:
4345
yield group
4446

4547

4648
def cases(paths):
49+
"""
50+
Each individual test case within all groups within the provided paths.
51+
"""
4752
for test_group in groups(paths):
4853
for test in test_group["tests"]:
4954
test["schema"] = test_group["schema"]
5055
yield test
5156

5257

5358
def collect(root_dir):
59+
"""
60+
All of the test file paths within the given root directory, recursively.
61+
"""
5462
for root, _, files in os.walk(root_dir):
5563
for filename in fnmatch.filter(files, "*.json"):
5664
yield os.path.join(root, filename)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[
2+
{
3+
"description": "unknown format",
4+
"schema": { "format": "unknown" },
5+
"tests": [
6+
{
7+
"description": "unknown formats ignore integers",
8+
"data": 12,
9+
"valid": true
10+
},
11+
{
12+
"description": "unknown formats ignore floats",
13+
"data": 13.7,
14+
"valid": true
15+
},
16+
{
17+
"description": "unknown formats ignore objects",
18+
"data": {},
19+
"valid": true
20+
},
21+
{
22+
"description": "unknown formats ignore arrays",
23+
"data": [],
24+
"valid": true
25+
},
26+
{
27+
"description": "unknown formats ignore booleans",
28+
"data": false,
29+
"valid": true
30+
},
31+
{
32+
"description": "unknown formats ignore nulls",
33+
"data": null,
34+
"valid": true
35+
},
36+
{
37+
"description": "unknown formats ignore strings",
38+
"data": "string",
39+
"valid": true
40+
}
41+
]
42+
}
43+
]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[
2+
{
3+
"description": "unknown format",
4+
"schema": { "format": "unknown" },
5+
"tests": [
6+
{
7+
"description": "unknown formats ignore integers",
8+
"data": 12,
9+
"valid": true
10+
},
11+
{
12+
"description": "unknown formats ignore floats",
13+
"data": 13.7,
14+
"valid": true
15+
},
16+
{
17+
"description": "unknown formats ignore objects",
18+
"data": {},
19+
"valid": true
20+
},
21+
{
22+
"description": "unknown formats ignore arrays",
23+
"data": [],
24+
"valid": true
25+
},
26+
{
27+
"description": "unknown formats ignore booleans",
28+
"data": false,
29+
"valid": true
30+
},
31+
{
32+
"description": "unknown formats ignore nulls",
33+
"data": null,
34+
"valid": true
35+
},
36+
{
37+
"description": "unknown formats ignore strings",
38+
"data": "string",
39+
"valid": true
40+
}
41+
]
42+
}
43+
]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[
2+
{
3+
"description": "unknown format",
4+
"schema": { "format": "unknown" },
5+
"tests": [
6+
{
7+
"description": "unknown formats ignore integers",
8+
"data": 12,
9+
"valid": true
10+
},
11+
{
12+
"description": "unknown formats ignore floats",
13+
"data": 13.7,
14+
"valid": true
15+
},
16+
{
17+
"description": "unknown formats ignore objects",
18+
"data": {},
19+
"valid": true
20+
},
21+
{
22+
"description": "unknown formats ignore arrays",
23+
"data": [],
24+
"valid": true
25+
},
26+
{
27+
"description": "unknown formats ignore booleans",
28+
"data": false,
29+
"valid": true
30+
},
31+
{
32+
"description": "unknown formats ignore nulls",
33+
"data": null,
34+
"valid": true
35+
},
36+
{
37+
"description": "unknown formats ignore strings",
38+
"data": "string",
39+
"valid": true
40+
}
41+
]
42+
}
43+
]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[
2+
{
3+
"description": "unknown format",
4+
"schema": { "format": "unknown" },
5+
"tests": [
6+
{
7+
"description": "unknown formats ignore integers",
8+
"data": 12,
9+
"valid": true
10+
},
11+
{
12+
"description": "unknown formats ignore floats",
13+
"data": 13.7,
14+
"valid": true
15+
},
16+
{
17+
"description": "unknown formats ignore objects",
18+
"data": {},
19+
"valid": true
20+
},
21+
{
22+
"description": "unknown formats ignore arrays",
23+
"data": [],
24+
"valid": true
25+
},
26+
{
27+
"description": "unknown formats ignore booleans",
28+
"data": false,
29+
"valid": true
30+
},
31+
{
32+
"description": "unknown formats ignore nulls",
33+
"data": null,
34+
"valid": true
35+
},
36+
{
37+
"description": "unknown formats ignore strings",
38+
"data": "string",
39+
"valid": true
40+
}
41+
]
42+
}
43+
]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[
2+
{
3+
"description": "unknown format",
4+
"schema": { "format": "unknown" },
5+
"tests": [
6+
{
7+
"description": "unknown formats ignore integers",
8+
"data": 12,
9+
"valid": true
10+
},
11+
{
12+
"description": "unknown formats ignore floats",
13+
"data": 13.7,
14+
"valid": true
15+
},
16+
{
17+
"description": "unknown formats ignore objects",
18+
"data": {},
19+
"valid": true
20+
},
21+
{
22+
"description": "unknown formats ignore arrays",
23+
"data": [],
24+
"valid": true
25+
},
26+
{
27+
"description": "unknown formats ignore booleans",
28+
"data": false,
29+
"valid": true
30+
},
31+
{
32+
"description": "unknown formats ignore nulls",
33+
"data": null,
34+
"valid": true
35+
},
36+
{
37+
"description": "unknown formats ignore strings",
38+
"data": "string",
39+
"valid": true
40+
}
41+
]
42+
}
43+
]

0 commit comments

Comments
 (0)