66to validate OAS 3.1 and OAS 3.2 schema validators against
77the canonical test cases.
88"""
9+
910import json
1011from pathlib import Path
1112from typing import Any
2526 / "tests"
2627)
2728
28- # Known failures due to limitations in the underlying jsonschema library.
2929# Each entry is (dialect, relative_path, case_description, test_description).
3030_KNOWN_FAILURES : dict [tuple [str , str , str , str ], str ] = {
31- (
32- "oas31" ,
33- "unevaluated.json" ,
34- "unevaluatedProperties with if/then/else" ,
35- "non-premium type with name is valid" ,
36- ): (
37- "jsonschema does not collect annotations from failing 'if' subschemas, "
38- "causing properties evaluated by 'if' to be reported as unevaluated"
39- ),
40- (
41- "oas32" ,
42- "unevaluated.json" ,
43- "unevaluatedProperties with if/then/else" ,
44- "non-premium type with name is valid" ,
45- ): (
46- "jsonschema does not collect annotations from failing 'if' subschemas, "
47- "causing properties evaluated by 'if' to be reported as unevaluated"
48- ),
4931 (
5032 "oas31" ,
5133 "optional/format/format-assertion.json" ,
@@ -95,7 +77,9 @@ def _collect_params() -> list[pytest.param]:
9577 for json_path in sorted (dialect_dir .rglob ("*.json" )):
9678 rel_path = json_path .relative_to (dialect_dir )
9779 is_in_optional_dir = rel_path .parts [0 ] == "optional"
98- format_checker = config ["format_checker" ] if is_in_optional_dir else None
80+ format_checker = (
81+ config ["format_checker" ] if is_in_optional_dir else None
82+ )
9983
10084 test_cases : list [dict [str , Any ]] = json .loads (
10185 json_path .read_text (encoding = "utf-8" )
@@ -108,9 +92,7 @@ def _collect_params() -> list[pytest.param]:
10892 data : Any = test ["data" ]
10993 expected_valid : bool = test ["valid" ]
11094
111- param_id = (
112- f"{ dialect } /{ rel_path } /{ case_desc } /{ test_desc } "
113- )
95+ param_id = f"{ dialect } /{ rel_path } /{ case_desc } /{ test_desc } "
11496 failure_key = (
11597 dialect ,
11698 str (rel_path ),
0 commit comments