Skip to content

Commit

Permalink
Merge commit '64b8c575640dcf7c9e7a5a434de6a331881ab4ec'
Browse files Browse the repository at this point in the history
* commit '64b8c575640dcf7c9e7a5a434de6a331881ab4ec':
  Squashed 'json/' changes from 5cc9214e8..4ecd01f30
  • Loading branch information
Julian committed Sep 20, 2023
2 parents bc46054 + 64b8c57 commit dd5dd20
Show file tree
Hide file tree
Showing 12 changed files with 235 additions and 6 deletions.
9 changes: 4 additions & 5 deletions json/bin/jsonschema_suite
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import warnings
try:
import jsonschema.validators
except ImportError:
jsonschema = None
jsonschema = Unresolvable = None
VALIDATORS = {}
else:
from referencing.exceptions import Unresolvable

VALIDATORS = {
"draft3": jsonschema.validators.Draft3Validator,
"draft4": jsonschema.validators.Draft4Validator,
Expand Down Expand Up @@ -587,7 +589,7 @@ class SanityTests(unittest.TestCase):
with self.subTest(case=case, version=version.name):
try:
Validator(case["schema"]).is_valid(12)
except jsonschema.exceptions.RefResolutionError:
except Unresolvable:
pass

@unittest.skipIf(jsonschema is None, "Validation library not present!")
Expand Down Expand Up @@ -615,9 +617,6 @@ class SanityTests(unittest.TestCase):
with self.subTest(path=path):
try:
validator.validate(cases)
except jsonschema.exceptions.RefResolutionError:
# python-jsonschema/jsonschema#884
pass
except jsonschema.ValidationError as error:
self.fail(str(error))

Expand Down
25 changes: 25 additions & 0 deletions json/tests/draft-next/optional/format/hostname.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,31 @@
"description": "exceeds maximum label length",
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
"valid": false
},
{
"description": "single label",
"data": "hostname",
"valid": true
},
{
"description": "single label with hyphen",
"data": "host-name",
"valid": true
},
{
"description": "single label with digits",
"data": "h0stn4me",
"valid": true
},
{
"description": "single label starting with digit",
"data": "1host",
"valid": true
},
{
"description": "single label ending with digit",
"data": "hostnam3",
"valid": true
}
]
}
Expand Down
25 changes: 25 additions & 0 deletions json/tests/draft-next/optional/format/idn-hostname.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,31 @@
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1 https://www.w3.org/TR/alreq/#h_disjoining_enforcement",
"data": "\u0628\u064a\u200c\u0628\u064a",
"valid": true
},
{
"description": "single label",
"data": "hostname",
"valid": true
},
{
"description": "single label with hyphen",
"data": "host-name",
"valid": true
},
{
"description": "single label with digits",
"data": "h0stn4me",
"valid": true
},
{
"description": "single label starting with digit",
"data": "1host",
"valid": true
},
{
"description": "single label ending with digit",
"data": "hostnam3",
"valid": true
}
]
}
Expand Down
25 changes: 25 additions & 0 deletions json/tests/draft2019-09/optional/format/hostname.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,31 @@
"description": "exceeds maximum label length",
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
"valid": false
},
{
"description": "single label",
"data": "hostname",
"valid": true
},
{
"description": "single label with hyphen",
"data": "host-name",
"valid": true
},
{
"description": "single label with digits",
"data": "h0stn4me",
"valid": true
},
{
"description": "single label starting with digit",
"data": "1host",
"valid": true
},
{
"description": "single label ending with digit",
"data": "hostnam3",
"valid": true
}
]
}
Expand Down
25 changes: 25 additions & 0 deletions json/tests/draft2019-09/optional/format/idn-hostname.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,31 @@
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1 https://www.w3.org/TR/alreq/#h_disjoining_enforcement",
"data": "\u0628\u064a\u200c\u0628\u064a",
"valid": true
},
{
"description": "single label",
"data": "hostname",
"valid": true
},
{
"description": "single label with hyphen",
"data": "host-name",
"valid": true
},
{
"description": "single label with digits",
"data": "h0stn4me",
"valid": true
},
{
"description": "single label starting with digit",
"data": "1host",
"valid": true
},
{
"description": "single label ending with digit",
"data": "hostnam3",
"valid": true
}
]
}
Expand Down
25 changes: 25 additions & 0 deletions json/tests/draft2020-12/optional/format/hostname.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,31 @@
"description": "exceeds maximum label length",
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
"valid": false
},
{
"description": "single label",
"data": "hostname",
"valid": true
},
{
"description": "single label with hyphen",
"data": "host-name",
"valid": true
},
{
"description": "single label with digits",
"data": "h0stn4me",
"valid": true
},
{
"description": "single label starting with digit",
"data": "1host",
"valid": true
},
{
"description": "single label ending with digit",
"data": "hostnam3",
"valid": true
}
]
}
Expand Down
25 changes: 25 additions & 0 deletions json/tests/draft2020-12/optional/format/idn-hostname.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,31 @@
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1 https://www.w3.org/TR/alreq/#h_disjoining_enforcement",
"data": "\u0628\u064a\u200c\u0628\u064a",
"valid": true
},
{
"description": "single label",
"data": "hostname",
"valid": true
},
{
"description": "single label with hyphen",
"data": "host-name",
"valid": true
},
{
"description": "single label with digits",
"data": "h0stn4me",
"valid": true
},
{
"description": "single label starting with digit",
"data": "1host",
"valid": true
},
{
"description": "single label ending with digit",
"data": "hostnam3",
"valid": true
}
]
}
Expand Down
20 changes: 20 additions & 0 deletions json/tests/draft4/optional/format/hostname.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,26 @@
"description": "exceeds maximum label length",
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
"valid": false
},
{
"description": "single label",
"data": "hostname",
"valid": true
},
{
"description": "single label with hyphen",
"data": "host-name",
"valid": true
},
{
"description": "single label with digits",
"data": "h0stn4me",
"valid": true
},
{
"description": "single label ending with digit",
"data": "hostnam3",
"valid": true
}
]
}
Expand Down
20 changes: 20 additions & 0 deletions json/tests/draft6/optional/format/hostname.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,26 @@
"description": "exceeds maximum label length",
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
"valid": false
},
{
"description": "single label",
"data": "hostname",
"valid": true
},
{
"description": "single label with hyphen",
"data": "host-name",
"valid": true
},
{
"description": "single label with digits",
"data": "h0stn4me",
"valid": true
},
{
"description": "single label ending with digit",
"data": "hostnam3",
"valid": true
}
]
}
Expand Down
20 changes: 20 additions & 0 deletions json/tests/draft7/optional/format/hostname.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,26 @@
"description": "exceeds maximum label length",
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
"valid": false
},
{
"description": "single label",
"data": "hostname",
"valid": true
},
{
"description": "single label with hyphen",
"data": "host-name",
"valid": true
},
{
"description": "single label with digits",
"data": "h0stn4me",
"valid": true
},
{
"description": "single label ending with digit",
"data": "hostnam3",
"valid": true
}
]
}
Expand Down
20 changes: 20 additions & 0 deletions json/tests/draft7/optional/format/idn-hostname.json
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,26 @@
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1 https://www.w3.org/TR/alreq/#h_disjoining_enforcement",
"data": "\u0628\u064a\u200c\u0628\u064a",
"valid": true
},
{
"description": "single label",
"data": "hostname",
"valid": true
},
{
"description": "single label with hyphen",
"data": "host-name",
"valid": true
},
{
"description": "single label with digits",
"data": "h0stn4me",
"valid": true
},
{
"description": "single label ending with digit",
"data": "hostnam3",
"valid": true
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion json/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ skipsdist = True

[testenv:sanity]
# used just for validating the structure of the test case files themselves
deps = jsonschema==4.18.0a4
deps = jsonschema==4.19.0
commands = {envpython} bin/jsonschema_suite check

0 comments on commit dd5dd20

Please sign in to comment.