Skip to content

Commit

Permalink
--wip-- [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Oct 16, 2023
1 parent 19807c1 commit 6576c1d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions pystac/pystac_rs.pyi
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
class Item:
id: str
version: str
10 changes: 10 additions & 0 deletions pystac/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
11 changes: 11 additions & 0 deletions pystac/tests/test_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 6576c1d

Please sign in to comment.