Skip to content

Commit c3ac362

Browse files
committed
993 pre-commit faff
1 parent c0e5df8 commit c3ac362

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

tests/extensions/test_projection.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import json
2-
import unittest
32
from copy import deepcopy
43
from typing import Any
54

@@ -81,9 +80,8 @@ def example_uri() -> str:
8180

8281
@pytest.fixture
8382
def example_summaries_uri() -> str:
84-
return TestCases.get_path(
85-
"data-files/projection/collection-with-summaries.json"
86-
)
83+
return TestCases.get_path("data-files/projection/collection-with-summaries.json")
84+
8785

8886
def test_to_from_dict(example_uri: str) -> None:
8987
with open(example_uri) as f:
@@ -117,11 +115,13 @@ def test_partial_apply(example_uri: str) -> None:
117115
assert ProjectionExtension.ext(proj_item).epsg == 1111
118116
proj_item.validate()
119117

118+
120119
@pytest.mark.vcr()
121120
def test_validate_proj(example_uri: str) -> None:
122121
item = pystac.Item.from_file(example_uri)
123122
item.validate()
124123

124+
125125
@pytest.mark.vcr()
126126
def test_epsg(example_uri: str) -> None:
127127
proj_item = pystac.Item.from_file(example_uri)
@@ -157,6 +157,7 @@ def test_epsg(example_uri: str) -> None:
157157
# Validate
158158
proj_item.validate()
159159

160+
160161
def test_optional_epsg() -> None:
161162
example_uri = TestCases.get_path("data-files/projection/optional-epsg.json")
162163
proj_item = pystac.Item.from_file(example_uri)
@@ -207,6 +208,7 @@ def test_wkt2(example_uri: str) -> None:
207208
# Validate
208209
proj_item.validate()
209210

211+
210212
@pytest.mark.vcr()
211213
def test_projjson(example_uri: str) -> None:
212214
proj_item = pystac.Item.from_file(example_uri)
@@ -251,6 +253,7 @@ def test_projjson(example_uri: str) -> None:
251253
ProjectionExtension.ext(proj_item).projjson = {"bad": "data"}
252254
proj_item.validate()
253255

256+
254257
def test_crs_string(example_uri: str) -> None:
255258
item = pystac.Item.from_file(example_uri)
256259
ProjectionExtension.remove_from(item)
@@ -277,6 +280,7 @@ def test_crs_string(example_uri: str) -> None:
277280
projection.code = "IAU_2015:49900"
278281
assert projection.crs_string == "IAU_2015:49900"
279282

283+
280284
@pytest.mark.vcr()
281285
def test_geometry(example_uri: str) -> None:
282286
proj_item = pystac.Item.from_file(example_uri)
@@ -318,6 +322,7 @@ def test_geometry(example_uri: str) -> None:
318322
ProjectionExtension.ext(proj_item).geometry = {"bad": "data"}
319323
proj_item.validate()
320324

325+
321326
@pytest.mark.vcr()
322327
def test_bbox(example_uri: str) -> None:
323328
proj_item = pystac.Item.from_file(example_uri)
@@ -352,6 +357,7 @@ def test_bbox(example_uri: str) -> None:
352357
# Validate
353358
proj_item.validate()
354359

360+
355361
@pytest.mark.vcr()
356362
def test_centroid(example_uri: str) -> None:
357363
proj_item = pystac.Item.from_file(example_uri)
@@ -392,6 +398,7 @@ def test_centroid(example_uri: str) -> None:
392398
ProjectionExtension.ext(proj_item).centroid = {"lat": 2.0, "lng": 3.0}
393399
proj_item.validate()
394400

401+
395402
@pytest.mark.vcr()
396403
def test_shape(example_uri: str) -> None:
397404
proj_item = pystac.Item.from_file(example_uri)
@@ -427,6 +434,7 @@ def test_shape(example_uri: str) -> None:
427434
# Validate
428435
proj_item.validate()
429436

437+
430438
@pytest.mark.vcr()
431439
def test_transform(example_uri: str) -> None:
432440
proj_item = pystac.Item.from_file(example_uri)
@@ -472,6 +480,7 @@ def test_transform(example_uri: str) -> None:
472480
# Validate
473481
proj_item.validate()
474482

483+
475484
def test_extension_not_implemented(example_uri: str) -> None:
476485
# Should raise exception if Item does not include extension URI
477486
item = pystac.Item.from_file(example_uri)
@@ -490,6 +499,7 @@ def test_extension_not_implemented(example_uri: str) -> None:
490499
ownerless_asset = pystac.Asset.from_dict(asset.to_dict())
491500
_ = ProjectionExtension.ext(ownerless_asset)
492501

502+
493503
def test_item_ext_add_to(example_uri: str) -> None:
494504
item = pystac.Item.from_file(example_uri)
495505
item.stac_extensions.remove(ProjectionExtension.get_schema_uri())
@@ -499,6 +509,7 @@ def test_item_ext_add_to(example_uri: str) -> None:
499509

500510
assert ProjectionExtension.get_schema_uri() in item.stac_extensions
501511

512+
502513
def test_asset_ext_add_to(example_uri: str) -> None:
503514
item = pystac.Item.from_file(example_uri)
504515
item.stac_extensions.remove(ProjectionExtension.get_schema_uri())
@@ -509,6 +520,7 @@ def test_asset_ext_add_to(example_uri: str) -> None:
509520

510521
assert ProjectionExtension.get_schema_uri() in item.stac_extensions
511522

523+
512524
def test_should_raise_exception_when_passing_invalid_extension_object() -> None:
513525
with pytest.raises(
514526
ExtensionTypeError,
@@ -517,6 +529,7 @@ def test_should_raise_exception_when_passing_invalid_extension_object() -> None:
517529
# intentionally calling this wrong so ---vvv
518530
ProjectionExtension.ext(object()) # type: ignore
519531

532+
520533
def test_get_summaries(example_summaries_uri: str) -> None:
521534
col = pystac.Collection.from_file(example_summaries_uri)
522535
proj_summaries = ProjectionExtension.summaries(col)
@@ -527,6 +540,7 @@ def test_get_summaries(example_summaries_uri: str) -> None:
527540
assert epsg_summaries is not None
528541
assert epsg_summaries == [32614]
529542

543+
530544
def test_set_summaries(example_summaries_uri: str) -> None:
531545
col = pystac.Collection.from_file(example_summaries_uri)
532546
proj_summaries = ProjectionExtension.summaries(col)
@@ -538,6 +552,7 @@ def test_set_summaries(example_summaries_uri: str) -> None:
538552
col_dict = col.to_dict()
539553
assert col_dict["summaries"]["proj:code"] == ["EPSG:4326"]
540554

555+
541556
def test_summaries_adds_uri(example_summaries_uri: str) -> None:
542557
col = pystac.Collection.from_file(example_summaries_uri)
543558
col.stac_extensions = []

0 commit comments

Comments
 (0)