summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2021-11-03 17:51:33 -0700
committerGitHub <noreply@github.com>2021-11-03 17:51:33 -0700
commit4a2232a882b12101d99584f35cf8b9000bd44c7c (patch)
tree3e6c8603468bb6ee8fb648e26ae971ec7eb008f9
parented4693ca07c912f7640997f67401d31076959081 (diff)
parent1085b27490c1af645edcac1c4093b01f563ddb7a (diff)
downloadjsonschema-4a2232a882b12101d99584f35cf8b9000bd44c7c.tar.gz
Merge pull request #875 from DrGFreeman/866-unique-items-more-than-two
Ensure all elements of arrays are verified for uniqueness
-rw-r--r--jsonschema/_utils.py3
-rw-r--r--jsonschema/tests/test_jsonschema_test_suite.py60
2 files changed, 2 insertions, 61 deletions
diff --git a/jsonschema/_utils.py b/jsonschema/_utils.py
index e5051ec..0cfb84f 100644
--- a/jsonschema/_utils.py
+++ b/jsonschema/_utils.py
@@ -188,7 +188,8 @@ def uniq(container):
sliced = itertools.islice(sort, 1, None)
for i, j in zip(sort, sliced):
- return not _sequence_equal(i, j)
+ if _sequence_equal(i, j):
+ return False
except (NotImplementedError, TypeError):
seen = []
diff --git a/jsonschema/tests/test_jsonschema_test_suite.py b/jsonschema/tests/test_jsonschema_test_suite.py
index 695009d..da46cf3 100644
--- a/jsonschema/tests/test_jsonschema_test_suite.py
+++ b/jsonschema/tests/test_jsonschema_test_suite.py
@@ -165,16 +165,6 @@ TestDraft3 = DRAFT3.to_unittest_testcase(
or missing_format(draft3_format_checker)(test)
or complex_email_validation(test)
or skip(
- message=bug(866),
- subject="uniqueItems",
- description="non-unique array of more than two arrays is invalid",
- )(test)
- or skip(
- message=bug(866),
- subject="uniqueItems",
- description="non-unique array of strings is invalid",
- )(test)
- or skip(
message=bug(371),
subject="ref",
case_description=(
@@ -201,16 +191,6 @@ TestDraft4 = DRAFT4.to_unittest_testcase(
or missing_format(draft4_format_checker)(test)
or complex_email_validation(test)
or skip(
- message=bug(866),
- subject="uniqueItems",
- description="non-unique array of more than two arrays is invalid",
- )(test)
- or skip(
- message=bug(866),
- subject="uniqueItems",
- description="non-unique array of strings is invalid",
- )(test)
- or skip(
message=bug(),
subject="ref",
case_description="Recursive references between schemas",
@@ -272,16 +252,6 @@ TestDraft6 = DRAFT6.to_unittest_testcase(
or missing_format(draft6_format_checker)(test)
or complex_email_validation(test)
or skip(
- message=bug(866),
- subject="uniqueItems",
- description="non-unique array of more than two arrays is invalid",
- )(test)
- or skip(
- message=bug(866),
- subject="uniqueItems",
- description="non-unique array of strings is invalid",
- )(test)
- or skip(
message=bug(371),
subject="ref",
case_description=(
@@ -321,16 +291,6 @@ TestDraft7 = DRAFT7.to_unittest_testcase(
or missing_format(draft7_format_checker)(test)
or complex_email_validation(test)
or skip(
- message=bug(866),
- subject="uniqueItems",
- description="non-unique array of more than two arrays is invalid",
- )(test)
- or skip(
- message=bug(866),
- subject="uniqueItems",
- description="non-unique array of strings is invalid",
- )(test)
- or skip(
message=bug(371),
subject="ref",
case_description=(
@@ -397,16 +357,6 @@ TestDraft201909 = DRAFT201909.to_unittest_testcase(
subject="unevaluatedItems",
)(test)
or skip(
- message=bug(866),
- subject="uniqueItems",
- description="non-unique array of more than two arrays is invalid",
- )(test)
- or skip(
- message=bug(866),
- subject="uniqueItems",
- description="non-unique array of strings is invalid",
- )(test)
- or skip(
message="dynamicRef support isn't working yet.",
subject="recursiveRef",
)(test)
@@ -451,16 +401,6 @@ TestDraft202012 = DRAFT202012.to_unittest_testcase(
skip=lambda test: (
narrow_unicode_build(test)
or skip(
- message=bug(866),
- subject="uniqueItems",
- description="non-unique array of more than two arrays is invalid",
- )(test)
- or skip(
- message=bug(866),
- subject="uniqueItems",
- description="non-unique array of strings is invalid",
- )(test)
- or skip(
message="dynamicRef support isn't working yet.",
subject="dynamicRef",
)(test)