diff options
author | Julian Berman <Julian@GrayVines.com> | 2021-11-03 18:35:19 -0400 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2021-11-03 18:35:19 -0400 |
commit | c9b74362198d21cea59794c414f0877452ab9fa7 (patch) | |
tree | 0a3e4dd0530fe0387351a8c22907051a8803555f | |
parent | ddef3b4a06be6f66dc1384e31a408ee7658bac1a (diff) | |
download | jsonschema-c9b74362198d21cea59794c414f0877452ab9fa7.tar.gz |
Squashed 'json/' changes from 329efe59c..9263b5250
9263b5250 Merge pull request #525 from DrGFreeman/524-uniqueItems-tests
2c5368886 Add tests instead of modifying existing tests
de84a59c5 Add and modify uniqueItems tests
git-subtree-dir: json
git-subtree-split: 9263b52500a6688ba02181ef2299ec4a894b589e
-rw-r--r-- | tests/draft-next/uniqueItems.json | 20 | ||||
-rw-r--r-- | tests/draft2019-09/uniqueItems.json | 20 | ||||
-rw-r--r-- | tests/draft2020-12/uniqueItems.json | 20 | ||||
-rw-r--r-- | tests/draft3/uniqueItems.json | 20 | ||||
-rw-r--r-- | tests/draft4/uniqueItems.json | 20 | ||||
-rw-r--r-- | tests/draft6/uniqueItems.json | 20 | ||||
-rw-r--r-- | tests/draft7/uniqueItems.json | 20 |
7 files changed, 140 insertions, 0 deletions
diff --git a/tests/draft-next/uniqueItems.json b/tests/draft-next/uniqueItems.json index b3762cb..85c619d 100644 --- a/tests/draft-next/uniqueItems.json +++ b/tests/draft-next/uniqueItems.json @@ -14,6 +14,11 @@ "valid": false }, { + "description": "non-unique array of more than two integers is invalid", + "data": [1, 2, 1], + "valid": false + }, + { "description": "numbers are unique if mathematically unequal", "data": [1.0, 1.00, 1], "valid": false @@ -29,6 +34,16 @@ "valid": true }, { + "description": "unique array of strings is valid", + "data": ["foo", "bar", "baz"], + "valid": true + }, + { + "description": "non-unique array of strings is invalid", + "data": ["foo", "bar", "foo"], + "valid": false + }, + { "description": "unique array of objects is valid", "data": [{"foo": "bar"}, {"foo": "baz"}], "valid": true @@ -65,6 +80,11 @@ "valid": false }, { + "description": "non-unique array of more than two arrays is invalid", + "data": [["foo"], ["bar"], ["foo"]], + "valid": false + }, + { "description": "1 and true are unique", "data": [1, true], "valid": true diff --git a/tests/draft2019-09/uniqueItems.json b/tests/draft2019-09/uniqueItems.json index 4846c77..2ccf666 100644 --- a/tests/draft2019-09/uniqueItems.json +++ b/tests/draft2019-09/uniqueItems.json @@ -14,6 +14,11 @@ "valid": false }, { + "description": "non-unique array of more than two integers is invalid", + "data": [1, 2, 1], + "valid": false + }, + { "description": "numbers are unique if mathematically unequal", "data": [1.0, 1.00, 1], "valid": false @@ -29,6 +34,16 @@ "valid": true }, { + "description": "unique array of strings is valid", + "data": ["foo", "bar", "baz"], + "valid": true + }, + { + "description": "non-unique array of strings is invalid", + "data": ["foo", "bar", "foo"], + "valid": false + }, + { "description": "unique array of objects is valid", "data": [{"foo": "bar"}, {"foo": "baz"}], "valid": true @@ -65,6 +80,11 @@ "valid": false }, { + "description": "non-unique array of more than two arrays is invalid", + "data": [["foo"], ["bar"], ["foo"]], + "valid": false + }, + { "description": "1 and true are unique", "data": [1, true], "valid": true diff --git a/tests/draft2020-12/uniqueItems.json b/tests/draft2020-12/uniqueItems.json index b3762cb..85c619d 100644 --- a/tests/draft2020-12/uniqueItems.json +++ b/tests/draft2020-12/uniqueItems.json @@ -14,6 +14,11 @@ "valid": false }, { + "description": "non-unique array of more than two integers is invalid", + "data": [1, 2, 1], + "valid": false + }, + { "description": "numbers are unique if mathematically unequal", "data": [1.0, 1.00, 1], "valid": false @@ -29,6 +34,16 @@ "valid": true }, { + "description": "unique array of strings is valid", + "data": ["foo", "bar", "baz"], + "valid": true + }, + { + "description": "non-unique array of strings is invalid", + "data": ["foo", "bar", "foo"], + "valid": false + }, + { "description": "unique array of objects is valid", "data": [{"foo": "bar"}, {"foo": "baz"}], "valid": true @@ -65,6 +80,11 @@ "valid": false }, { + "description": "non-unique array of more than two arrays is invalid", + "data": [["foo"], ["bar"], ["foo"]], + "valid": false + }, + { "description": "1 and true are unique", "data": [1, true], "valid": true diff --git a/tests/draft3/uniqueItems.json b/tests/draft3/uniqueItems.json index fd4b849..c48c6a0 100644 --- a/tests/draft3/uniqueItems.json +++ b/tests/draft3/uniqueItems.json @@ -14,11 +14,26 @@ "valid": false }, { + "description": "non-unique array of more than two integers is invalid", + "data": [1, 2, 1], + "valid": false + }, + { "description": "numbers are unique if mathematically unequal", "data": [1.0, 1.00, 1], "valid": false }, { + "description": "unique array of strings is valid", + "data": ["foo", "bar", "baz"], + "valid": true + }, + { + "description": "non-unique array of strings is invalid", + "data": ["foo", "bar", "foo"], + "valid": false + }, + { "description": "unique array of objects is valid", "data": [{"foo": "bar"}, {"foo": "baz"}], "valid": true @@ -55,6 +70,11 @@ "valid": false }, { + "description": "non-unique array of more than two arrays is invalid", + "data": [["foo"], ["bar"], ["foo"]], + "valid": false + }, + { "description": "1 and true are unique", "data": [1, true], "valid": true diff --git a/tests/draft4/uniqueItems.json b/tests/draft4/uniqueItems.json index 4846c77..2ccf666 100644 --- a/tests/draft4/uniqueItems.json +++ b/tests/draft4/uniqueItems.json @@ -14,6 +14,11 @@ "valid": false }, { + "description": "non-unique array of more than two integers is invalid", + "data": [1, 2, 1], + "valid": false + }, + { "description": "numbers are unique if mathematically unequal", "data": [1.0, 1.00, 1], "valid": false @@ -29,6 +34,16 @@ "valid": true }, { + "description": "unique array of strings is valid", + "data": ["foo", "bar", "baz"], + "valid": true + }, + { + "description": "non-unique array of strings is invalid", + "data": ["foo", "bar", "foo"], + "valid": false + }, + { "description": "unique array of objects is valid", "data": [{"foo": "bar"}, {"foo": "baz"}], "valid": true @@ -65,6 +80,11 @@ "valid": false }, { + "description": "non-unique array of more than two arrays is invalid", + "data": [["foo"], ["bar"], ["foo"]], + "valid": false + }, + { "description": "1 and true are unique", "data": [1, true], "valid": true diff --git a/tests/draft6/uniqueItems.json b/tests/draft6/uniqueItems.json index 4846c77..2ccf666 100644 --- a/tests/draft6/uniqueItems.json +++ b/tests/draft6/uniqueItems.json @@ -14,6 +14,11 @@ "valid": false }, { + "description": "non-unique array of more than two integers is invalid", + "data": [1, 2, 1], + "valid": false + }, + { "description": "numbers are unique if mathematically unequal", "data": [1.0, 1.00, 1], "valid": false @@ -29,6 +34,16 @@ "valid": true }, { + "description": "unique array of strings is valid", + "data": ["foo", "bar", "baz"], + "valid": true + }, + { + "description": "non-unique array of strings is invalid", + "data": ["foo", "bar", "foo"], + "valid": false + }, + { "description": "unique array of objects is valid", "data": [{"foo": "bar"}, {"foo": "baz"}], "valid": true @@ -65,6 +80,11 @@ "valid": false }, { + "description": "non-unique array of more than two arrays is invalid", + "data": [["foo"], ["bar"], ["foo"]], + "valid": false + }, + { "description": "1 and true are unique", "data": [1, true], "valid": true diff --git a/tests/draft7/uniqueItems.json b/tests/draft7/uniqueItems.json index 4846c77..2ccf666 100644 --- a/tests/draft7/uniqueItems.json +++ b/tests/draft7/uniqueItems.json @@ -14,6 +14,11 @@ "valid": false }, { + "description": "non-unique array of more than two integers is invalid", + "data": [1, 2, 1], + "valid": false + }, + { "description": "numbers are unique if mathematically unequal", "data": [1.0, 1.00, 1], "valid": false @@ -29,6 +34,16 @@ "valid": true }, { + "description": "unique array of strings is valid", + "data": ["foo", "bar", "baz"], + "valid": true + }, + { + "description": "non-unique array of strings is invalid", + "data": ["foo", "bar", "foo"], + "valid": false + }, + { "description": "unique array of objects is valid", "data": [{"foo": "bar"}, {"foo": "baz"}], "valid": true @@ -65,6 +80,11 @@ "valid": false }, { + "description": "non-unique array of more than two arrays is invalid", + "data": [["foo"], ["bar"], ["foo"]], + "valid": false + }, + { "description": "1 and true are unique", "data": [1, true], "valid": true |