Skip to content

Commit 3cc1715

Browse files
committed
Add test of reading and writing to hrefs starting with file:///
1 parent 94bf972 commit 3cc1715

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_stac_io.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ def test_read_write_collection(self) -> None:
2424
pystac.write_file(collection, dest_href=dest_href)
2525
self.assertTrue(os.path.exists(dest_href), msg="File was not written.")
2626

27+
def test_read_write_collection_with_file_protocol(self) -> None:
28+
collection = pystac.read_file(
29+
"file://" + TestCases.get_path("data-files/collections/multi-extent.json")
30+
)
31+
with tempfile.TemporaryDirectory() as tmp_dir:
32+
dest_href = os.path.join(tmp_dir, "collection.json")
33+
pystac.write_file(collection, dest_href="file://" + dest_href)
34+
self.assertTrue(os.path.exists(dest_href), msg="File was not written.")
35+
2736
def test_read_item(self) -> None:
2837
item = pystac.read_file(TestCases.get_path("data-files/item/sample-item.json"))
2938
with tempfile.TemporaryDirectory() as tmp_dir:

0 commit comments

Comments
 (0)