Skip to content

Commit 64b8c57

Browse files
committed
Squashed 'json/' changes from 5cc9214e8..4ecd01f30
4ecd01f30 Merge pull request #687 from swaeberle/check-single-label-idn-hostnames 732e7275a test single label IDN hostnames ab3924a66 Merge pull request #685 from swaeberle/check-single-label-hostnames 9265a4fa9 do not test hostname with leading digit for older drafts 261b52db1 do not allow starting digits in hostnames for older drafts 9fc231ea4 test digits in hostnames e9b20158e test plain single label hostnames c8b57093d test valid single label hostnames 299aa7fe5 Merge pull request #682 from json-schema-org/useless-branch fbb3cac60 Bump the sanity check to use a released version of jsonschema git-subtree-dir: json git-subtree-split: 4ecd01f30bce36a61224fa0f46c2c3f0cf7481dc
1 parent eb56578 commit 64b8c57

File tree

12 files changed

+235
-6
lines changed

12 files changed

+235
-6
lines changed

bin/jsonschema_suite

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ import warnings
1414
try:
1515
import jsonschema.validators
1616
except ImportError:
17-
jsonschema = None
17+
jsonschema = Unresolvable = None
1818
VALIDATORS = {}
1919
else:
20+
from referencing.exceptions import Unresolvable
21+
2022
VALIDATORS = {
2123
"draft3": jsonschema.validators.Draft3Validator,
2224
"draft4": jsonschema.validators.Draft4Validator,
@@ -587,7 +589,7 @@ class SanityTests(unittest.TestCase):
587589
with self.subTest(case=case, version=version.name):
588590
try:
589591
Validator(case["schema"]).is_valid(12)
590-
except jsonschema.exceptions.RefResolutionError:
592+
except Unresolvable:
591593
pass
592594

593595
@unittest.skipIf(jsonschema is None, "Validation library not present!")
@@ -615,9 +617,6 @@ class SanityTests(unittest.TestCase):
615617
with self.subTest(path=path):
616618
try:
617619
validator.validate(cases)
618-
except jsonschema.exceptions.RefResolutionError:
619-
# python-jsonschema/jsonschema#884
620-
pass
621620
except jsonschema.ValidationError as error:
622621
self.fail(str(error))
623622

tests/draft-next/optional/format/hostname.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,31 @@
9595
"description": "exceeds maximum label length",
9696
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
9797
"valid": false
98+
},
99+
{
100+
"description": "single label",
101+
"data": "hostname",
102+
"valid": true
103+
},
104+
{
105+
"description": "single label with hyphen",
106+
"data": "host-name",
107+
"valid": true
108+
},
109+
{
110+
"description": "single label with digits",
111+
"data": "h0stn4me",
112+
"valid": true
113+
},
114+
{
115+
"description": "single label starting with digit",
116+
"data": "1host",
117+
"valid": true
118+
},
119+
{
120+
"description": "single label ending with digit",
121+
"data": "hostnam3",
122+
"valid": true
98123
}
99124
]
100125
}

tests/draft-next/optional/format/idn-hostname.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,31 @@
301301
"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",
302302
"data": "\u0628\u064a\u200c\u0628\u064a",
303303
"valid": true
304+
},
305+
{
306+
"description": "single label",
307+
"data": "hostname",
308+
"valid": true
309+
},
310+
{
311+
"description": "single label with hyphen",
312+
"data": "host-name",
313+
"valid": true
314+
},
315+
{
316+
"description": "single label with digits",
317+
"data": "h0stn4me",
318+
"valid": true
319+
},
320+
{
321+
"description": "single label starting with digit",
322+
"data": "1host",
323+
"valid": true
324+
},
325+
{
326+
"description": "single label ending with digit",
327+
"data": "hostnam3",
328+
"valid": true
304329
}
305330
]
306331
}

tests/draft2019-09/optional/format/hostname.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,31 @@
9595
"description": "exceeds maximum label length",
9696
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
9797
"valid": false
98+
},
99+
{
100+
"description": "single label",
101+
"data": "hostname",
102+
"valid": true
103+
},
104+
{
105+
"description": "single label with hyphen",
106+
"data": "host-name",
107+
"valid": true
108+
},
109+
{
110+
"description": "single label with digits",
111+
"data": "h0stn4me",
112+
"valid": true
113+
},
114+
{
115+
"description": "single label starting with digit",
116+
"data": "1host",
117+
"valid": true
118+
},
119+
{
120+
"description": "single label ending with digit",
121+
"data": "hostnam3",
122+
"valid": true
98123
}
99124
]
100125
}

tests/draft2019-09/optional/format/idn-hostname.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,31 @@
301301
"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",
302302
"data": "\u0628\u064a\u200c\u0628\u064a",
303303
"valid": true
304+
},
305+
{
306+
"description": "single label",
307+
"data": "hostname",
308+
"valid": true
309+
},
310+
{
311+
"description": "single label with hyphen",
312+
"data": "host-name",
313+
"valid": true
314+
},
315+
{
316+
"description": "single label with digits",
317+
"data": "h0stn4me",
318+
"valid": true
319+
},
320+
{
321+
"description": "single label starting with digit",
322+
"data": "1host",
323+
"valid": true
324+
},
325+
{
326+
"description": "single label ending with digit",
327+
"data": "hostnam3",
328+
"valid": true
304329
}
305330
]
306331
}

tests/draft2020-12/optional/format/hostname.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,31 @@
9595
"description": "exceeds maximum label length",
9696
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
9797
"valid": false
98+
},
99+
{
100+
"description": "single label",
101+
"data": "hostname",
102+
"valid": true
103+
},
104+
{
105+
"description": "single label with hyphen",
106+
"data": "host-name",
107+
"valid": true
108+
},
109+
{
110+
"description": "single label with digits",
111+
"data": "h0stn4me",
112+
"valid": true
113+
},
114+
{
115+
"description": "single label starting with digit",
116+
"data": "1host",
117+
"valid": true
118+
},
119+
{
120+
"description": "single label ending with digit",
121+
"data": "hostnam3",
122+
"valid": true
98123
}
99124
]
100125
}

tests/draft2020-12/optional/format/idn-hostname.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,31 @@
301301
"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",
302302
"data": "\u0628\u064a\u200c\u0628\u064a",
303303
"valid": true
304+
},
305+
{
306+
"description": "single label",
307+
"data": "hostname",
308+
"valid": true
309+
},
310+
{
311+
"description": "single label with hyphen",
312+
"data": "host-name",
313+
"valid": true
314+
},
315+
{
316+
"description": "single label with digits",
317+
"data": "h0stn4me",
318+
"valid": true
319+
},
320+
{
321+
"description": "single label starting with digit",
322+
"data": "1host",
323+
"valid": true
324+
},
325+
{
326+
"description": "single label ending with digit",
327+
"data": "hostnam3",
328+
"valid": true
304329
}
305330
]
306331
}

tests/draft4/optional/format/hostname.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,26 @@
9292
"description": "exceeds maximum label length",
9393
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
9494
"valid": false
95+
},
96+
{
97+
"description": "single label",
98+
"data": "hostname",
99+
"valid": true
100+
},
101+
{
102+
"description": "single label with hyphen",
103+
"data": "host-name",
104+
"valid": true
105+
},
106+
{
107+
"description": "single label with digits",
108+
"data": "h0stn4me",
109+
"valid": true
110+
},
111+
{
112+
"description": "single label ending with digit",
113+
"data": "hostnam3",
114+
"valid": true
95115
}
96116
]
97117
}

tests/draft6/optional/format/hostname.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,26 @@
9292
"description": "exceeds maximum label length",
9393
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
9494
"valid": false
95+
},
96+
{
97+
"description": "single label",
98+
"data": "hostname",
99+
"valid": true
100+
},
101+
{
102+
"description": "single label with hyphen",
103+
"data": "host-name",
104+
"valid": true
105+
},
106+
{
107+
"description": "single label with digits",
108+
"data": "h0stn4me",
109+
"valid": true
110+
},
111+
{
112+
"description": "single label ending with digit",
113+
"data": "hostnam3",
114+
"valid": true
95115
}
96116
]
97117
}

tests/draft7/optional/format/hostname.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,26 @@
9292
"description": "exceeds maximum label length",
9393
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
9494
"valid": false
95+
},
96+
{
97+
"description": "single label",
98+
"data": "hostname",
99+
"valid": true
100+
},
101+
{
102+
"description": "single label with hyphen",
103+
"data": "host-name",
104+
"valid": true
105+
},
106+
{
107+
"description": "single label with digits",
108+
"data": "h0stn4me",
109+
"valid": true
110+
},
111+
{
112+
"description": "single label ending with digit",
113+
"data": "hostnam3",
114+
"valid": true
95115
}
96116
]
97117
}

tests/draft7/optional/format/idn-hostname.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,26 @@
298298
"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",
299299
"data": "\u0628\u064a\u200c\u0628\u064a",
300300
"valid": true
301+
},
302+
{
303+
"description": "single label",
304+
"data": "hostname",
305+
"valid": true
306+
},
307+
{
308+
"description": "single label with hyphen",
309+
"data": "host-name",
310+
"valid": true
311+
},
312+
{
313+
"description": "single label with digits",
314+
"data": "h0stn4me",
315+
"valid": true
316+
},
317+
{
318+
"description": "single label ending with digit",
319+
"data": "hostnam3",
320+
"valid": true
301321
}
302322
]
303323
}

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ skipsdist = True
55

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

0 commit comments

Comments
 (0)