Skip to content

Commit 1725799

Browse files
committed
chore: ruff file format
1 parent e9144ed commit 1725799

1 file changed

Lines changed: 39 additions & 13 deletions

File tree

tests/web/test_main.py

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def test_write_file_non_ascii(client: TestClient, project_tmp_path: Path) -> Non
118118
}
119119

120120

121-
122121
def test_update_file(client: TestClient, project_tmp_path: Path) -> None:
123122
txt_file = project_tmp_path / "foo.txt"
124123
txt_file.write_text("bar")
@@ -150,7 +149,9 @@ def test_rename_file(client: TestClient, project_tmp_path: Path) -> None:
150149
assert not txt_file.exists()
151150

152151

153-
def test_rename_file_and_keep_content(client: TestClient, project_tmp_path: Path) -> None:
152+
def test_rename_file_and_keep_content(
153+
client: TestClient, project_tmp_path: Path
154+
) -> None:
154155
txt_file = project_tmp_path / "foo.txt"
155156
txt_file.write_text("bar")
156157

@@ -191,7 +192,9 @@ def test_rename_file_already_exists(client: TestClient, project_tmp_path: Path)
191192
assert not foo_file.exists()
192193

193194

194-
def test_rename_file_to_existing_directory(client: TestClient, project_tmp_path: Path) -> None:
195+
def test_rename_file_to_existing_directory(
196+
client: TestClient, project_tmp_path: Path
197+
) -> None:
195198
foo_file = project_tmp_path / "foo.txt"
196199
foo_file.touch()
197200
existing_dir = project_tmp_path / "existing_dir"
@@ -225,10 +228,17 @@ def test_create_directory(client: TestClient, project_tmp_path: Path) -> None:
225228
response = client.post("/api/directories/new_dir")
226229
assert response.status_code == 200
227230
assert (project_tmp_path / "new_dir").exists()
228-
assert response.json() == {"directories": [], "files": [], "name": "new_dir", "path": "new_dir"}
231+
assert response.json() == {
232+
"directories": [],
233+
"files": [],
234+
"name": "new_dir",
235+
"path": "new_dir",
236+
}
229237

230238

231-
def test_create_directory_already_exists(client: TestClient, project_tmp_path: Path) -> None:
239+
def test_create_directory_already_exists(
240+
client: TestClient, project_tmp_path: Path
241+
) -> None:
232242
new_dir = project_tmp_path / "new_dir"
233243
new_dir.mkdir()
234244

@@ -253,7 +263,9 @@ def test_rename_directory(client: TestClient, project_tmp_path: Path) -> None:
253263
}
254264

255265

256-
def test_rename_directory_already_exists_empty(client: TestClient, project_tmp_path: Path) -> None:
266+
def test_rename_directory_already_exists_empty(
267+
client: TestClient, project_tmp_path: Path
268+
) -> None:
257269
new_dir = project_tmp_path / "new_dir"
258270
new_dir.mkdir()
259271
existing_dir = project_tmp_path / "renamed_dir"
@@ -287,7 +299,9 @@ def test_rename_directory_already_exists_not_empty(
287299
assert new_dir.exists()
288300

289301

290-
def test_rename_directory_to_existing_file(client: TestClient, project_tmp_path: Path) -> None:
302+
def test_rename_directory_to_existing_file(
303+
client: TestClient, project_tmp_path: Path
304+
) -> None:
291305
new_dir = project_tmp_path / "new_dir"
292306
new_dir.mkdir()
293307
existing_file = project_tmp_path / "foo.txt"
@@ -313,7 +327,9 @@ def test_delete_directory_not_found(client: TestClient, project_tmp_path: Path)
313327
assert response.status_code == 404
314328

315329

316-
def test_delete_directory_not_a_directory(client: TestClient, project_tmp_path: Path) -> None:
330+
def test_delete_directory_not_a_directory(
331+
client: TestClient, project_tmp_path: Path
332+
) -> None:
317333
txt_file = project_tmp_path / "foo.txt"
318334
txt_file.touch()
319335

@@ -377,7 +393,9 @@ def test_plan_test_failures(
377393
async def test_cancel(client: TestClient) -> None:
378394
client.app.state.circuit_breaker = threading.Event() # type: ignore
379395
transport = ASGITransport(client.app) # type: ignore
380-
async with AsyncClient(transport=transport, base_url="http://testserver") as _client:
396+
async with AsyncClient(
397+
transport=transport, base_url="http://testserver"
398+
) as _client:
381399
await _client.post("/api/plan", json={"environment": "dev"})
382400
response = await _client.post("/api/plan/cancel")
383401
assert response.status_code == 204
@@ -422,7 +440,9 @@ def test_modules(client: TestClient) -> None:
422440

423441

424442
def test_fetchdf(client: TestClient, web_sushi_context: Context) -> None:
425-
response = client.post("/api/commands/fetchdf", json={"sql": "SELECT * from sushi.top_waiters"})
443+
response = client.post(
444+
"/api/commands/fetchdf", json={"sql": "SELECT * from sushi.top_waiters"}
445+
)
426446
assert response.status_code == 200
427447
with pa.ipc.open_stream(response.content) as reader:
428448
df = reader.read_pandas()
@@ -490,7 +510,9 @@ def test_get_environments(client: TestClient, project_context: Context) -> None:
490510
plan_id="",
491511
suffix_target="schema",
492512
)
493-
assert response_json["pinned_environments"] == list(project_context.config.pinned_environments)
513+
assert response_json["pinned_environments"] == list(
514+
project_context.config.pinned_environments
515+
)
494516
assert (
495517
response_json["default_target_environment"]
496518
== project_context.config.default_target_environment
@@ -507,7 +529,9 @@ def test_delete_environment_failure(
507529
client: TestClient, web_sushi_context: Context, mocker: MockerFixture
508530
):
509531
mocker.patch.object(
510-
web_sushi_context.state_sync, "invalidate_environment", side_effect=Exception("Some error")
532+
web_sushi_context.state_sync,
533+
"invalidate_environment",
534+
side_effect=Exception("Some error"),
511535
)
512536

513537
response = client.delete("/api/environments/test")
@@ -544,7 +568,9 @@ def test_test(client: TestClient, web_sushi_context: Context) -> None:
544568
assert response_json["failures"] == []
545569

546570
# Single test
547-
response = client.get("/api/commands/test", params={"test": "tests/test_order_items.yaml"})
571+
response = client.get(
572+
"/api/commands/test", params={"test": "tests/test_order_items.yaml"}
573+
)
548574
assert response.status_code == 200
549575
response_json = response.json()
550576
assert response_json["tests_run"] == 1

0 commit comments

Comments
 (0)