Skip to content

Commit 83c58af

Browse files
committed
Add test to demonstrate proper function of non-hierarchical relative links
1 parent 21906a0 commit 83c58af

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_item.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,3 +607,19 @@ def test_resolve_collection_with_root(
607607
root = read_collection.get_root()
608608
assert root
609609
assert root.id == "root"
610+
611+
612+
def test_non_hierarchical_relative_link() -> None:
613+
root = pystac.Catalog("root", "root")
614+
a = pystac.Catalog("a", "a")
615+
b = pystac.Catalog("b", "b")
616+
617+
root.add_child(a)
618+
root.add_child(b)
619+
a.add_link(pystac.Link("related", b))
620+
621+
root.catalog_type = pystac.catalog.CatalogType.SELF_CONTAINED
622+
root.normalize_hrefs("test_output")
623+
related_href = [link for link in a.links if link.rel == "related"][0].get_href()
624+
625+
assert related_href is not None and not is_absolute_href(related_href)

0 commit comments

Comments
 (0)