@@ -42,35 +42,27 @@ def test_validate_examples(self) -> None:
42
42
path = example .path
43
43
valid = example .valid
44
44
45
- if stac_version < "0.8" :
45
+ with self . subTest ( path ) :
46
46
with open (path , encoding = "utf-8" ) as f :
47
47
stac_json = json .load (f )
48
48
49
- self .assertEqual (len (pystac .validation .validate_dict (stac_json )), 0 )
50
- else :
51
- with self .subTest (path ):
52
- with open (path , encoding = "utf-8" ) as f :
53
- stac_json = json .load (f )
54
-
55
- # Check if common properties need to be merged
56
- if stac_version < "1.0" :
57
- if example .object_type == pystac .STACObjectType .ITEM :
58
- collection_cache = CollectionCache ()
59
- merge_common_properties (
60
- stac_json , collection_cache , path
49
+ # Check if common properties need to be merged
50
+ if stac_version < "1.0" :
51
+ if example .object_type == pystac .STACObjectType .ITEM :
52
+ collection_cache = CollectionCache ()
53
+ merge_common_properties (stac_json , collection_cache , path )
54
+
55
+ if valid :
56
+ pystac .validation .validate_dict (stac_json )
57
+ else :
58
+ with self .assertRaises (pystac .STACValidationError ):
59
+ try :
60
+ pystac .validation .validate_dict (stac_json )
61
+ except pystac .STACValidationError as e :
62
+ self .assertIsInstance (
63
+ e .source , jsonschema .ValidationError
61
64
)
62
-
63
- if valid :
64
- pystac .validation .validate_dict (stac_json )
65
- else :
66
- with self .assertRaises (pystac .STACValidationError ):
67
- try :
68
- pystac .validation .validate_dict (stac_json )
69
- except pystac .STACValidationError as e :
70
- self .assertIsInstance (
71
- e .source , jsonschema .ValidationError
72
- )
73
- raise e
65
+ raise e
74
66
75
67
def test_validate_error_contains_href (self ) -> None :
76
68
# Test that the exception message contains the HREF of the object if available.
0 commit comments