Skip to content

Commit 7f8f6b4

Browse files
amyfromandigithub-actions[bot]
authored andcommitted
Format code and sort imports
1 parent 53a5efc commit 7f8f6b4

File tree

4 files changed

+29
-20
lines changed

4 files changed

+29
-20
lines changed

services/api-v3/api/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
from typing import Optional
2+
13
from pydantic import Field
24
from pydantic_settings import BaseSettings, SettingsConfigDict
3-
from typing import Optional
45

56

67
class Settings(BaseSettings):

services/api-v3/api/tests/test_database.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ def api_client() -> TestClient:
4141
yield client
4242

4343

44-
45-
4644
@pytest.fixture
4745
async def engine() -> AsyncEngine:
4846
await connect_engine()

services/api-v3/api/tests/test_fieldsite.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ def test_spot_to_checkin_from_featurecollection(self, api_client):
208208
assert c["observations"][0]["orientation"]["strike"] == pytest.approx(123.0)
209209
assert c["observations"][0]["orientation"]["dip"] == pytest.approx(45.0)
210210

211-
212211
def test_spot_to_checkin_accepts_single_fieldsite_dict(self, api_client):
213212
# your spot_to_checkin treats dict with "location" as already-FieldSite-shaped
214213
payload = _fieldsite_dict(fs_id=501)
@@ -223,7 +222,6 @@ def test_spot_to_checkin_accepts_single_fieldsite_dict(self, api_client):
223222
assert "created" in out and isinstance(out["created"], str)
224223
assert "updated" in out and isinstance(out["updated"], str)
225224

226-
227225
def test_checkin_to_fieldsite_single(self, api_client):
228226
payload = _checkin(checkin_id=77)
229227
resp = api_client.post(
@@ -273,7 +271,6 @@ def test_fieldsite_to_checkin_list(self, api_client):
273271
assert "created" in c0 and isinstance(c0["created"], str)
274272
assert "updated" in c0 and isinstance(c0["updated"], str)
275273

276-
277274
def test_fieldsite_to_checkin_single_returns_list_of_one(self, api_client):
278275
payload = _fieldsite_dict(fs_id=999)
279276
resp = api_client.post(
@@ -287,7 +284,6 @@ def test_fieldsite_to_checkin_single_returns_list_of_one(self, api_client):
287284
assert "created" in out and isinstance(out["created"], str)
288285
assert "updated" in out and isinstance(out["updated"], str)
289286

290-
291287
def test_fieldsite_to_spot_single(self, api_client):
292288
payload = _fieldsite_dict(fs_id=1234)
293289
resp = api_client.post(

services/api-v3/api/tests/test_object.py

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ def _assert_object_row_shape(obj: Dict[str, Any]) -> None:
4949
assert isinstance(obj["id"], int)
5050
assert isinstance(obj["key"], str)
5151
assert isinstance(obj["mime_type"], str)
52-
assert isinstance(obj["source"], (dict, str, type(None))) # _row_to_dict tries to coerce
52+
assert isinstance(
53+
obj["source"], (dict, str, type(None))
54+
) # _row_to_dict tries to coerce
5355

5456

55-
def _post_object_files(
56-
api_client, files: List[Tuple[str, Tuple[str, bytes, str]]]
57-
):
57+
def _post_object_files(api_client, files: List[Tuple[str, Tuple[str, bytes, str]]]):
5858
"""
5959
POST /object expects multipart/form-data with one or many files under field name 'object'.
6060
@@ -64,7 +64,9 @@ def _post_object_files(
6464
return api_client.post("/object", files=files)
6565

6666

67-
def _create_one(api_client, *, name: Optional[str] = None, content: bytes = b"hello") -> Dict[str, Any]:
67+
def _create_one(
68+
api_client, *, name: Optional[str] = None, content: bytes = b"hello"
69+
) -> Dict[str, Any]:
6870
name = name or f"{_rand()}.txt"
6971
resp = _post_object_files(api_client, [("object", (name, content, "text/plain"))])
7072
assert resp.status_code == 200
@@ -82,17 +84,21 @@ class CreatedObject:
8284
id: int
8385
key: str
8486

87+
8588
@pytest.fixture(scope="module")
8689
def object_registry(api_client):
8790
created: List[CreatedObject] = []
8891
yield created
8992
for obj in reversed(created):
9093
resp = api_client.delete(f"/object/{obj.id}?hard=true")
91-
assert resp.status_code == 200, (
92-
f"Cleanup hard delete failed for id={obj.id} key={obj.key}: {resp.text}"
93-
)
94+
assert (
95+
resp.status_code == 200
96+
), f"Cleanup hard delete failed for id={obj.id} key={obj.key}: {resp.text}"
9497

95-
def _register_created(registry: List[CreatedObject], objects_created: List[Dict[str, Any]]) -> None:
98+
99+
def _register_created(
100+
registry: List[CreatedObject], objects_created: List[Dict[str, Any]]
101+
) -> None:
96102
for o in objects_created:
97103
registry.append(CreatedObject(id=o["id"], key=o["key"]))
98104

@@ -114,7 +120,9 @@ def test_post_requires_field_name_object(self, api_client):
114120

115121
def test_post_single_file_creates_row(self, api_client, object_registry):
116122
name = f"{_rand()}.txt"
117-
resp = _post_object_files(api_client, [("object", (name, b"hello", "text/plain"))])
123+
resp = _post_object_files(
124+
api_client, [("object", (name, b"hello", "text/plain"))]
125+
)
118126
assert resp.status_code == 200
119127

120128
out = resp.json()
@@ -149,13 +157,17 @@ def test_post_multiple_files_creates_multiple(self, api_client, object_registry)
149157
def test_post_duplicate_key_skips(self, api_client, object_registry):
150158
name = f"{_rand()}.txt"
151159

152-
r1 = _post_object_files(api_client, [("object", (name, b"first", "text/plain"))])
160+
r1 = _post_object_files(
161+
api_client, [("object", (name, b"first", "text/plain"))]
162+
)
153163
assert r1.status_code == 200
154164
created1 = r1.json()["objects_created"]
155165
assert len(created1) == 1
156166
_register_created(object_registry, created1)
157167

158-
r2 = _post_object_files(api_client, [("object", (name, b"second", "text/plain"))])
168+
r2 = _post_object_files(
169+
api_client, [("object", (name, b"second", "text/plain"))]
170+
)
159171
assert r2.status_code == 200
160172
created2 = r2.json()["objects_created"]
161173
assert len(created2) == 0 # skipped
@@ -236,7 +248,9 @@ def test_patch_updates_source_and_mime_type(self, api_client, object_registry):
236248
assert isinstance(out["source"], dict)
237249
assert out["source"]["comments"] == "test"
238250

239-
resp2 = api_client.patch(f"/object/{oid}", json={"mime_type": "application/pdf"})
251+
resp2 = api_client.patch(
252+
f"/object/{oid}", json={"mime_type": "application/pdf"}
253+
)
240254
assert resp2.status_code == 200
241255
assert resp2.json()["mime_type"] == "application/pdf"
242256

0 commit comments

Comments
 (0)