Skip to content

Commit 9729a5b

Browse files
committed
chore: Remove redundant assertions
`if not is_valid` can't happen, because `is_valid = not is_absolute_href(asset.href)` and the condition above that line is `if not is_absolute_href(asset.href):`. Conversely, since `is_valid` is always `True` there is no point in `self.assertTrue(is_valid)`.
1 parent 6c62066 commit 9729a5b

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

tests/test_writing.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import pystac
66
from 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
88
from pystac.validation import validate_dict
99

1010
from 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

0 commit comments

Comments
 (0)