summaryrefslogtreecommitdiff
path: root/json
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2022-01-12 05:51:03 -0500
committerJulian Berman <Julian@GrayVines.com>2022-01-12 05:51:03 -0500
commit6b3f22e463c10e7620ad0a95116ab95662bd6c57 (patch)
tree76a98ab8ea851ca4595401a8467c54e79ba8902d /json
parenteed6d8bc4bd46fc34c5a0257a3338d8afea2c2d7 (diff)
parentaaf8e3125211f6fcda17b0a47e54a74c362202b7 (diff)
downloadjsonschema-6b3f22e463c10e7620ad0a95116ab95662bd6c57.tar.gz
Merge commit 'aaf8e3125211f6fcda17b0a47e54a74c362202b7'
* commit 'aaf8e3125211f6fcda17b0a47e54a74c362202b7': Squashed 'json/' changes from 20fb14bde..3731ed32a
Diffstat (limited to 'json')
-rwxr-xr-xjson/bin/jsonschema_suite16
-rw-r--r--json/tests/draft2019-09/optional/format/unknown.json43
-rw-r--r--json/tests/draft2020-12/optional/format/unknown.json43
-rw-r--r--json/tests/draft4/optional/format/unknown.json43
-rw-r--r--json/tests/draft6/optional/format/unknown.json43
-rw-r--r--json/tests/draft7/optional/format/unknown.json43
6 files changed, 227 insertions, 4 deletions
diff --git a/json/bin/jsonschema_suite b/json/bin/jsonschema_suite
index 88e5986..1af0c99 100755
--- a/json/bin/jsonschema_suite
+++ b/json/bin/jsonschema_suite
@@ -1,5 +1,4 @@
#! /usr/bin/env python3
-from pprint import pformat
import argparse
import errno
import fnmatch
@@ -12,9 +11,6 @@ import textwrap
import unittest
import warnings
-if getattr(unittest, "skipIf", None) is None:
- unittest.skipIf = lambda cond, msg : lambda fn : fn
-
try:
import jsonschema.validators
except ImportError:
@@ -32,18 +28,27 @@ with open(os.path.join(ROOT_DIR, "test-schema.json")) as schema:
def files(paths):
+ """
+ Each test file in the provided paths.
+ """
for path in paths:
with open(path) as test_file:
yield json.load(test_file)
def groups(paths):
+ """
+ Each test group within each file in the provided paths.
+ """
for test_file in files(paths):
for group in test_file:
yield group
def cases(paths):
+ """
+ Each individual test case within all groups within the provided paths.
+ """
for test_group in groups(paths):
for test in test_group["tests"]:
test["schema"] = test_group["schema"]
@@ -51,6 +56,9 @@ def cases(paths):
def collect(root_dir):
+ """
+ All of the test file paths within the given root directory, recursively.
+ """
for root, _, files in os.walk(root_dir):
for filename in fnmatch.filter(files, "*.json"):
yield os.path.join(root, filename)
diff --git a/json/tests/draft2019-09/optional/format/unknown.json b/json/tests/draft2019-09/optional/format/unknown.json
new file mode 100644
index 0000000..12339ae
--- /dev/null
+++ b/json/tests/draft2019-09/optional/format/unknown.json
@@ -0,0 +1,43 @@
+[
+ {
+ "description": "unknown format",
+ "schema": { "format": "unknown" },
+ "tests": [
+ {
+ "description": "unknown formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore strings",
+ "data": "string",
+ "valid": true
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft2020-12/optional/format/unknown.json b/json/tests/draft2020-12/optional/format/unknown.json
new file mode 100644
index 0000000..12339ae
--- /dev/null
+++ b/json/tests/draft2020-12/optional/format/unknown.json
@@ -0,0 +1,43 @@
+[
+ {
+ "description": "unknown format",
+ "schema": { "format": "unknown" },
+ "tests": [
+ {
+ "description": "unknown formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore strings",
+ "data": "string",
+ "valid": true
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft4/optional/format/unknown.json b/json/tests/draft4/optional/format/unknown.json
new file mode 100644
index 0000000..12339ae
--- /dev/null
+++ b/json/tests/draft4/optional/format/unknown.json
@@ -0,0 +1,43 @@
+[
+ {
+ "description": "unknown format",
+ "schema": { "format": "unknown" },
+ "tests": [
+ {
+ "description": "unknown formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore strings",
+ "data": "string",
+ "valid": true
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft6/optional/format/unknown.json b/json/tests/draft6/optional/format/unknown.json
new file mode 100644
index 0000000..12339ae
--- /dev/null
+++ b/json/tests/draft6/optional/format/unknown.json
@@ -0,0 +1,43 @@
+[
+ {
+ "description": "unknown format",
+ "schema": { "format": "unknown" },
+ "tests": [
+ {
+ "description": "unknown formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore strings",
+ "data": "string",
+ "valid": true
+ }
+ ]
+ }
+]
diff --git a/json/tests/draft7/optional/format/unknown.json b/json/tests/draft7/optional/format/unknown.json
new file mode 100644
index 0000000..12339ae
--- /dev/null
+++ b/json/tests/draft7/optional/format/unknown.json
@@ -0,0 +1,43 @@
+[
+ {
+ "description": "unknown format",
+ "schema": { "format": "unknown" },
+ "tests": [
+ {
+ "description": "unknown formats ignore integers",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore floats",
+ "data": 13.7,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore objects",
+ "data": {},
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore arrays",
+ "data": [],
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore booleans",
+ "data": false,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore nulls",
+ "data": null,
+ "valid": true
+ },
+ {
+ "description": "unknown formats ignore strings",
+ "data": "string",
+ "valid": true
+ }
+ ]
+ }
+]