summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2021-04-12 21:21:52 -0400
committerJulian Berman <Julian@GrayVines.com>2021-04-12 21:21:52 -0400
commit0d5e80a0c86835890ad01dd0ec1e7e3d2c0b3f28 (patch)
tree1c789b7c68a5f5fa6ed214d790e9f07c2d614647
parent2302e2ac453867abc00bbe599af84ce62e9838d2 (diff)
downloadjsonschema-0d5e80a0c86835890ad01dd0ec1e7e3d2c0b3f28.tar.gz
Allowing leading zeros is allowed by the JSON Schema spec...
And Python at the minute does so. That may change, see the discussion at https://bugs.python.org/issue36384. At that point these may get unskipped (and this library may change to follow it).
-rw-r--r--jsonschema/tests/test_jsonschema_test_suite.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/jsonschema/tests/test_jsonschema_test_suite.py b/jsonschema/tests/test_jsonschema_test_suite.py
index 26e4345..6f441ef 100644
--- a/jsonschema/tests/test_jsonschema_test_suite.py
+++ b/jsonschema/tests/test_jsonschema_test_suite.py
@@ -106,6 +106,14 @@ else:
def missing_date_fromisoformat(test):
return
+allowed_leading_zeros = skip(
+ message="This behavior is optional (and Python allows it)",
+ subject="ipv4",
+ description=(
+ "leading zeroes should be rejected, as they are treated as octals"
+ ),
+)
+
TestDraft3 = DRAFT3.to_unittest_testcase(
DRAFT3.tests(),
@@ -165,6 +173,7 @@ TestDraft4 = DRAFT4.to_unittest_testcase(
skip=lambda test: (
narrow_unicode_build(test)
or missing_date_fromisoformat(test)
+ or allowed_leading_zeros(test)
or missing_format(draft4_format_checker)(test)
or complex_email_validation(test)
or skip(
@@ -241,6 +250,7 @@ TestDraft6 = DRAFT6.to_unittest_testcase(
skip=lambda test: (
narrow_unicode_build(test)
or missing_date_fromisoformat(test)
+ or allowed_leading_zeros(test)
or missing_format(draft6_format_checker)(test)
or complex_email_validation(test)
or skip(
@@ -338,6 +348,7 @@ TestDraft7 = DRAFT7.to_unittest_testcase(
skip=lambda test: (
narrow_unicode_build(test)
or missing_date_fromisoformat(test)
+ or allowed_leading_zeros(test)
or missing_format(draft7_format_checker)(test)
or complex_email_validation(test)
or skip(