Skip to content

Commit

Permalink
Collection number type hint and conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
n3h3m committed Oct 11, 2020
1 parent 7ddfb9d commit e6ab5ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eodatasets3/properties.py
Expand Up @@ -416,7 +416,7 @@ def dataset_version(self) -> str:
return self.properties.get("odc:dataset_version")

@property
def collection_number(self) -> str:
def collection_number(self) -> int:
"""
The version of the collection.
Eg:
Expand All @@ -425,7 +425,7 @@ def collection_number(self) -> str:
dataset_version: 1.6.0
collection_number: 3
"""
return self.properties.get("odc:collection_number", "0")
return self.properties.get("odc:collection_number")

@dataset_version.setter
def dataset_version(self, value):
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/test_assemble.py
Expand Up @@ -425,6 +425,9 @@ def test_dea_c3_naming_conventions(tmp_path: Path):
p.dataset_version = "1.6.0"
p.collection_number = "3"

# Collection number returned as integer via the getter.
assert p.collection_number == 3

# Success case
dataset_id, metadata_path = p.done()
metadata_path_offset = metadata_path.relative_to(tmp_path).as_posix()
Expand Down

0 comments on commit e6ab5ed

Please sign in to comment.