-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: first v1 test * ci: run CI on v2 pull requests * feat: add assets mixin * fix: only try to deploy if we're on v2 branch
- Loading branch information
Showing
14 changed files
with
466 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import json | ||
from typing import Any | ||
|
||
import pytest | ||
|
||
from .utils import TestCases | ||
|
||
|
||
@pytest.fixture | ||
def sample_item_dict() -> dict[str, Any]: | ||
m = TestCases.get_path("data-files/item/sample-item.json") | ||
with open(m) as f: | ||
item_dict: dict[str, Any] = json.load(f) | ||
return item_dict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"type": "Feature", | ||
"stac_version": "1.1.0", | ||
"id": "CS3-20160503_132131_05", | ||
"properties": { | ||
"datetime": "2016-05-03T13:22:30.040000Z", | ||
"title": "A CS3 item", | ||
"license": "PDDL-1.0", | ||
"providers": [ | ||
{ | ||
"name": "CoolSat", | ||
"roles": [ | ||
"producer", | ||
"licensor" | ||
], | ||
"url": "https://cool-sat.com/" | ||
} | ||
] | ||
}, | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [ | ||
[ | ||
[ | ||
-122.308150179, | ||
37.488035566 | ||
], | ||
[ | ||
-122.597502109, | ||
37.538869539 | ||
], | ||
[ | ||
-122.576687533, | ||
37.613537207 | ||
], | ||
[ | ||
-122.2880486, | ||
37.562818007 | ||
], | ||
[ | ||
-122.308150179, | ||
37.488035566 | ||
] | ||
] | ||
] | ||
}, | ||
"links": [ | ||
{ | ||
"rel": "collection", | ||
"href": "https://raw.githubusercontent.com/radiantearth/stac-spec/v0.8.1/collection-spec/examples/sentinel2.json" | ||
} | ||
], | ||
"assets": { | ||
"analytic": { | ||
"href": "http://cool-sat.com/catalog/CS3-20160503_132130_04/analytic.tif", | ||
"title": "4-Band Analytic", | ||
"product": "http://cool-sat.com/catalog/products/analytic.json", | ||
"type": "image/tiff; application=geotiff; profile=cloud-optimized", | ||
"roles": [ | ||
"data", | ||
"analytic" | ||
] | ||
}, | ||
"thumbnail": { | ||
"href": "http://cool-sat.com/catalog/CS3-20160503_132130_04/thumbnail.png", | ||
"title": "Thumbnail", | ||
"type": "image/png", | ||
"roles": [ | ||
"thumbnail" | ||
] | ||
} | ||
}, | ||
"bbox": [ | ||
-122.59750209, | ||
37.48803556, | ||
-122.2880486, | ||
37.613537207 | ||
], | ||
"stac_extensions": [], | ||
"collection": "CS3" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from copy import deepcopy | ||
from typing import Any | ||
|
||
from pystac import Item | ||
|
||
from . import utils | ||
|
||
|
||
def test_to_from_dict(sample_item_dict: dict[str, Any]) -> None: | ||
param_dict = deepcopy(sample_item_dict) | ||
|
||
utils.assert_to_from_dict(Item, param_dict) | ||
item = Item.from_dict(param_dict) | ||
assert item.id == "CS3-20160503_132131_05" | ||
|
||
# test asset creation additional field(s) | ||
assert ( | ||
item.assets["analytic"].extra_fields["product"] | ||
== "http://cool-sat.com/catalog/products/analytic.json" | ||
) | ||
assert len(item.assets["thumbnail"].extra_fields) == 0 | ||
|
||
# test that the parameter is preserved | ||
assert param_dict == sample_item_dict | ||
|
||
# assert that the parameter is preserved regardless of preserve_dict | ||
Item.from_dict(param_dict, preserve_dict=False) | ||
assert param_dict == sample_item_dict |
Oops, something went wrong.