@@ -64,9 +64,7 @@ async def test_get_search_content_type(app_client, ctx):
6464@pytest .mark .asyncio
6565async def test_api_headers (app_client ):
6666 resp = await app_client .get ("/api" )
67- assert (
68- resp .headers ["Content-Type" ] == "application/vnd.oai.openapi+json;version=3.0"
69- )
67+ assert resp .headers ["Content-Type" ] == "application/vnd.oai.openapi+json;version=3.0"
7068 assert resp .status_code == 200
7169
7270
@@ -109,9 +107,7 @@ async def test_app_context_results(app_client, txn_client, ctx, load_test_data):
109107 await create_collection (txn_client , test_collection )
110108 await create_item (txn_client , test_item )
111109
112- resp = await app_client .get (
113- f"/collections/{ test_collection ['id' ]} /items/{ test_item ['id' ]} "
114- )
110+ resp = await app_client .get (f"/collections/{ test_collection ['id' ]} /items/{ test_item ['id' ]} " )
115111 assert resp .status_code == 200
116112 resp_json = resp .json ()
117113 assert resp_json ["id" ] == test_item ["id" ]
@@ -161,9 +157,7 @@ async def test_app_fields_extension_query(app_client, ctx, txn_client):
161157
162158@pytest .mark .asyncio
163159async def test_app_fields_extension_no_properties_get (app_client , ctx , txn_client ):
164- resp = await app_client .get (
165- "/search" , params = {"collections" : ["test-collection" ], "fields" : "-properties" }
166- )
160+ resp = await app_client .get ("/search" , params = {"collections" : ["test-collection" ], "fields" : "-properties" })
167161 assert resp .status_code == 200
168162 resp_json = resp .json ()
169163 assert "properties" not in resp_json ["features" ][0 ]
@@ -194,20 +188,13 @@ async def test_app_fields_extension_no_null_fields(app_client, ctx, txn_client):
194188 for link in feature ["links" ]:
195189 assert all (a not in link or link [a ] is not None for a in ("title" , "asset" ))
196190 for asset in feature ["assets" ]:
197- assert all (
198- a not in asset or asset [a ] is not None
199- for a in ("start_datetime" , "created" )
200- )
191+ assert all (a not in asset or asset [a ] is not None for a in ("start_datetime" , "created" ))
201192
202193
203194@pytest .mark .asyncio
204- async def test_app_fields_extension_return_all_properties (
205- app_client , ctx , txn_client , load_test_data
206- ):
195+ async def test_app_fields_extension_return_all_properties (app_client , ctx , txn_client , load_test_data ):
207196 item = load_test_data ("test_item.json" )
208- resp = await app_client .get (
209- "/search" , params = {"collections" : ["test-collection" ], "fields" : "properties" }
210- )
197+ resp = await app_client .get ("/search" , params = {"collections" : ["test-collection" ], "fields" : "properties" })
211198 assert resp .status_code == 200
212199 resp_json = resp .json ()
213200 feature = resp_json ["features" ][0 ]
@@ -245,9 +232,7 @@ async def test_app_query_extension_gte(app_client, ctx):
245232
246233@pytest .mark .asyncio
247234async def test_app_query_extension_limit_lt0 (app_client ):
248- assert (
249- await app_client .post ("/search" , json = {"query" : {}, "limit" : - 1 })
250- ).status_code == 400
235+ assert (await app_client .post ("/search" , json = {"query" : {}, "limit" : - 1 })).status_code == 400
251236
252237
253238@pytest .mark .skip (reason = "removal of context extension" )
@@ -271,12 +256,10 @@ async def test_app_sort_extension_get_asc(app_client, txn_client, ctx):
271256
272257 second_item = dict (first_item )
273258 second_item ["id" ] = "another-item"
274- another_item_date = datetime .strptime (
275- first_item ["properties" ]["datetime" ], "%Y-%m-%dT%H:%M:%SZ"
276- ) - timedelta (days = 1 )
277- second_item ["properties" ]["datetime" ] = another_item_date .strftime (
278- "%Y-%m-%dT%H:%M:%SZ"
259+ another_item_date = datetime .strptime (first_item ["properties" ]["datetime" ], "%Y-%m-%dT%H:%M:%SZ" ) - timedelta (
260+ days = 1
279261 )
262+ second_item ["properties" ]["datetime" ] = another_item_date .strftime ("%Y-%m-%dT%H:%M:%SZ" )
280263
281264 await create_item (txn_client , second_item )
282265
@@ -293,12 +276,10 @@ async def test_app_sort_extension_get_desc(app_client, txn_client, ctx):
293276
294277 second_item = dict (first_item )
295278 second_item ["id" ] = "another-item"
296- another_item_date = datetime .strptime (
297- first_item ["properties" ]["datetime" ], "%Y-%m-%dT%H:%M:%SZ"
298- ) - timedelta (days = 1 )
299- second_item ["properties" ]["datetime" ] = another_item_date .strftime (
300- "%Y-%m-%dT%H:%M:%SZ"
279+ another_item_date = datetime .strptime (first_item ["properties" ]["datetime" ], "%Y-%m-%dT%H:%M:%SZ" ) - timedelta (
280+ days = 1
301281 )
282+ second_item ["properties" ]["datetime" ] = another_item_date .strftime ("%Y-%m-%dT%H:%M:%SZ" )
302283
303284 await create_item (txn_client , second_item )
304285
@@ -315,12 +296,10 @@ async def test_app_sort_extension_post_asc(app_client, txn_client, ctx):
315296
316297 second_item = dict (first_item )
317298 second_item ["id" ] = "another-item"
318- another_item_date = datetime .strptime (
319- first_item ["properties" ]["datetime" ], "%Y-%m-%dT%H:%M:%SZ"
320- ) - timedelta (days = 1 )
321- second_item ["properties" ]["datetime" ] = another_item_date .strftime (
322- "%Y-%m-%dT%H:%M:%SZ"
299+ another_item_date = datetime .strptime (first_item ["properties" ]["datetime" ], "%Y-%m-%dT%H:%M:%SZ" ) - timedelta (
300+ days = 1
323301 )
302+ second_item ["properties" ]["datetime" ] = another_item_date .strftime ("%Y-%m-%dT%H:%M:%SZ" )
324303
325304 await create_item (txn_client , second_item )
326305
@@ -341,12 +320,10 @@ async def test_app_sort_extension_post_desc(app_client, txn_client, ctx):
341320
342321 second_item = dict (first_item )
343322 second_item ["id" ] = "another-item"
344- another_item_date = datetime .strptime (
345- first_item ["properties" ]["datetime" ], "%Y-%m-%dT%H:%M:%SZ"
346- ) - timedelta (days = 1 )
347- second_item ["properties" ]["datetime" ] = another_item_date .strftime (
348- "%Y-%m-%dT%H:%M:%SZ"
323+ another_item_date = datetime .strptime (first_item ["properties" ]["datetime" ], "%Y-%m-%dT%H:%M:%SZ" ) - timedelta (
324+ days = 1
349325 )
326+ second_item ["properties" ]["datetime" ] = another_item_date .strftime ("%Y-%m-%dT%H:%M:%SZ" )
350327 await create_item (txn_client , second_item )
351328
352329 params = {
@@ -373,9 +350,7 @@ async def test_search_invalid_date(app_client, ctx):
373350
374351@pytest .mark .asyncio
375352async def test_search_point_intersects_get (app_client , ctx ):
376- resp = await app_client .get (
377- '/search?intersects={"type":"Point","coordinates":[150.04,-33.14]}'
378- )
353+ resp = await app_client .get ('/search?intersects={"type":"Point","coordinates":[150.04,-33.14]}' )
379354
380355 assert resp .status_code == 200
381356 resp_json = resp .json ()
@@ -646,25 +621,23 @@ async def test_patch_operations_collection(app_client, ctx):
646621 operations = [
647622 {"op" : "add" , "path" : "/summaries/hello" , "value" : "world" },
648623 {"op" : "replace" , "path" : "/summaries/gsd" , "value" : [50 ]},
649- # {
650- # "op": "move",
651- # "path": "/summaries/instruments",
652- # "from": "/summaries/instrument",
653- # },
624+ {
625+ "op" : "move" ,
626+ "path" : "/summaries/instruments" ,
627+ "from" : "/summaries/instrument" ,
628+ },
654629 # {"op": "copy", "from": "license", "path": "/summaries/license"},
655630 ]
656631
657632 resp = await app_client .patch (
658- f"/collections/{ ctx .item [ 'collection ' ]} " ,
633+ f"/collections/{ ctx .collection [ 'id ' ]} " ,
659634 json = operations ,
660635 headers = {"Content-Type" : "application/json-patch+json" },
661636 )
662637
663638 assert resp .status_code == 200
664639
665- new_resp = await app_client .get (
666- f"/collections/{ ctx .item ['collection' ]} /{ ctx .item ['id' ]} "
667- )
640+ new_resp = await app_client .get (f"/collections/{ ctx .collection ['id' ]} " )
668641
669642 assert new_resp .status_code == 200
670643
@@ -686,15 +659,11 @@ async def test_patch_json_item(app_client, ctx):
686659 "properties" : {"hello" : "world" , "proj:epsg" : 1000 , "landsat:column" : None },
687660 }
688661
689- resp = await app_client .patch (
690- f"/collections/{ ctx .item ['collection' ]} /items/{ ctx .item ['id' ]} " , json = data
691- )
662+ resp = await app_client .patch (f"/collections/{ ctx .item ['collection' ]} /items/{ ctx .item ['id' ]} " , json = data )
692663
693664 assert resp .status_code == 200
694665
695- new_resp = await app_client .get (
696- f"/collections/{ ctx .item ['collection' ]} /items/{ ctx .item ['id' ]} "
697- )
666+ new_resp = await app_client .get (f"/collections/{ ctx .item ['collection' ]} /items/{ ctx .item ['id' ]} " )
698667
699668 assert new_resp .status_code == 200
700669
@@ -712,7 +681,7 @@ async def test_patch_operations_item(app_client, ctx):
712681 {"op" : "add" , "path" : "/properties/hello" , "value" : "world" },
713682 {"op" : "remove" , "path" : "/properties/landsat:column" },
714683 {"op" : "replace" , "path" : "/properties/proj:epsg" , "value" : 1000 },
715- # {"op": "move", "path": "/properties/foo", "from": "/properties/instrument"},
684+ {"op" : "move" , "path" : "/properties/foo" , "from" : "/properties/instrument" },
716685 # {"op": "copy", "path": "/properties/bar", "from": "/properties/height"},
717686 ]
718687
@@ -724,9 +693,7 @@ async def test_patch_operations_item(app_client, ctx):
724693
725694 assert resp .status_code == 200
726695
727- new_resp = await app_client .get (
728- f"/collections/{ ctx .item ['collection' ]} /items/{ ctx .item ['id' ]} "
729- )
696+ new_resp = await app_client .get (f"/collections/{ ctx .item ['collection' ]} /items/{ ctx .item ['id' ]} " )
730697
731698 assert new_resp .status_code == 200
732699
@@ -769,16 +736,12 @@ async def test_search_line_string_intersects(app_client, ctx):
769736 (21474836470 , 1 ), # Above Int Limit
770737 ],
771738)
772- async def test_big_int_eo_search (
773- app_client , txn_client , test_item , test_collection , value , expected
774- ):
739+ async def test_big_int_eo_search (app_client , txn_client , test_item , test_collection , value , expected ):
775740 random_str = "" .join (random .choice ("abcdef" ) for _ in range (5 ))
776741 collection_id = f"test-collection-eo-{ random_str } "
777742
778743 test_collection ["id" ] = collection_id
779- test_collection ["stac_extensions" ] = [
780- "https://stac-extensions.github.io/eo/v2.0.0/schema.json"
781- ]
744+ test_collection ["stac_extensions" ] = ["https://stac-extensions.github.io/eo/v2.0.0/schema.json" ]
782745
783746 test_item ["collection" ] = collection_id
784747 test_item ["stac_extensions" ] = test_collection ["stac_extensions" ]
0 commit comments