44
55import pystac
66from pystac import Collection , CatalogType , HIERARCHICAL_LINKS
7- from pystac .utils import is_absolute_href , make_absolute_href , make_relative_href
7+ from pystac .utils import is_absolute_href , make_absolute_href
88from pystac .validation import validate_dict
99
1010from tests .utils import TestCases
@@ -35,18 +35,6 @@ def validate_file(self, path: str, object_type: str) -> List[Any]:
3535 def validate_link_types (
3636 self , root_href : str , catalog_type : pystac .CatalogType
3737 ) -> None :
38- def validate_asset_href_type (item : pystac .Item , item_href : str ) -> None :
39- for asset in item .assets .values ():
40- if not is_absolute_href (asset .href ):
41- is_valid = not is_absolute_href (asset .href )
42- if not is_valid :
43- # If the item href and asset href don't share
44- # the same root, the asset href must be absolute
45- rel_href = make_relative_href (asset .href , item_href )
46- self .assertEqual (asset .href , rel_href )
47- else :
48- self .assertTrue (is_valid )
49-
5038 def validate_item_link_type (
5139 href : str , link_type : str , should_include_self : bool
5240 ) -> None :
@@ -63,8 +51,6 @@ def validate_item_link_type(
6351 else :
6452 self .assertTrue (is_absolute_href (link .href ))
6553
66- validate_asset_href_type (item , href )
67-
6854 rels = set ([link ["rel" ] for link in item_dict ["links" ]])
6955 self .assertEqual ("self" in rels , should_include_self )
7056
@@ -73,10 +59,7 @@ def validate_catalog_link_type(
7359 ) -> None :
7460 cat_dict = pystac .StacIO .default ().read_json (href )
7561 cat = pystac .read_file (href )
76- if not isinstance (cat , pystac .Catalog ):
77- raise pystac .STACTypeError (
78- f"File at { href } is a { cat .STAC_OBJECT_TYPE } not a Catalog."
79- )
62+ assert isinstance (cat , pystac .Catalog )
8063
8164 rels = set ([link ["rel" ] for link in cat_dict ["links" ]])
8265 self .assertEqual ("self" in rels , should_include_self )
0 commit comments