From 64622fd8909ee9d57041c2ef18c29b51ca7f40a9 Mon Sep 17 00:00:00 2001 From: DrGFreeman Date: Wed, 3 Nov 2021 19:47:43 -0400 Subject: [PATCH 1/2] Revert "Temporarily skip the failing tests from #866." This reverts commit ed4693ca07c912f7640997f67401d31076959081. --- .../tests/test_jsonschema_test_suite.py | 60 ------------------- 1 file changed, 60 deletions(-) diff --git a/jsonschema/tests/test_jsonschema_test_suite.py b/jsonschema/tests/test_jsonschema_test_suite.py index 695009dcd..da46cf381 100644 --- a/jsonschema/tests/test_jsonschema_test_suite.py +++ b/jsonschema/tests/test_jsonschema_test_suite.py @@ -164,16 +164,6 @@ def leap_second(test): narrow_unicode_build(test) 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", @@ -200,16 +190,6 @@ def leap_second(test): or leap_second(test) 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", @@ -271,16 +251,6 @@ def leap_second(test): or leap_second(test) 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", @@ -320,16 +290,6 @@ def leap_second(test): or leap_second(test) 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", @@ -396,16 +356,6 @@ def leap_second(test): message="unevaluatedItems is different in 2019-09 (needs work).", 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", @@ -450,16 +400,6 @@ def leap_second(test): Validator=Draft202012Validator, 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", From 1085b27490c1af645edcac1c4093b01f563ddb7a Mon Sep 17 00:00:00 2001 From: DrGFreeman Date: Wed, 3 Nov 2021 20:19:56 -0400 Subject: [PATCH 2/2] Ensure all items of array are checked for uniqueness Fix bug where the function would return (True) early if the first two items of the array are unique, preventing verification of other array items. --- jsonschema/_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jsonschema/_utils.py b/jsonschema/_utils.py index e5051ec10..0cfb84fdf 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 = []