From 813e4386902b187b9d05150946073f01c0d99850 Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Mon, 16 Oct 2023 07:21:16 -0400 Subject: [PATCH] --wip-- [skip ci] --- pystac/pystac_rs.pyi | 1 + pystac/src/item.rs | 10 ++++++++++ pystac/tests/test_item.py | 11 +++++++++++ 3 files changed, 22 insertions(+) diff --git a/pystac/pystac_rs.pyi b/pystac/pystac_rs.pyi index 890e50d2..9699439e 100644 --- a/pystac/pystac_rs.pyi +++ b/pystac/pystac_rs.pyi @@ -1,2 +1,3 @@ class Item: id: str + version: str diff --git a/pystac/src/item.rs b/pystac/src/item.rs index 6d0e2a0c..a051fc56 100644 --- a/pystac/src/item.rs +++ b/pystac/src/item.rs @@ -19,4 +19,14 @@ impl Item { fn set_id(&mut self, id: String) { self.0.id = id; } + + #[getter] + fn version(&self) -> &str { + &self.0.version + } + + #[getter] + fn extensions(&self) -> &[&str] { + &self.0.extensions + } } diff --git a/pystac/tests/test_item.py b/pystac/tests/test_item.py index 4f064e0d..84247262 100644 --- a/pystac/tests/test_item.py +++ b/pystac/tests/test_item.py @@ -4,5 +4,16 @@ def test_init(): item = Item("an-id") assert item.id == "an-id" + assert item.version == "1.0.0" + assert item.extensions is None + assert item.geometry is None + assert item.bbox is None + assert item.properties["datetime"] is not None + assert item.links.empty() + assert item.collection is None + + +def test_setters(): + item = Item("an-id") item.id = "new-id" assert item.id == "new-id"