Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

style: format recent issue fixes

Bingxi Zhao (Frank)64dff25792e8
diff --git a/deeptutor/api/routers/reading.py b/deeptutor/api/routers/reading.py
index 5dc838793..5daf24e43 100644
--- a/deeptutor/api/routers/reading.py
+++ b/deeptutor/api/routers/reading.py
@@ -995,9 +995,7 @@ async def list_material_revisions(material_id: str) -> list[dict[str, Any]]:
"/materials/{material_id}/revisions/{revision}/units/{locator}",
response_model=UnitText,
)
-async def get_revision_unit(
- material_id: str, revision: int, locator: int
-) -> UnitText:
+async def get_revision_unit(material_id: str, revision: int, locator: int) -> UnitText:
store = _store()
try:
manifest = next(
diff --git a/tests/reading/test_ingestion.py b/tests/reading/test_ingestion.py
index 68f6504da..ef4f2a309 100644
--- a/tests/reading/test_ingestion.py
+++ b/tests/reading/test_ingestion.py
@@ -105,10 +105,13 @@ async def test_web_import_is_rich_localizes_images_and_preserves_old_revision(st
assert manifest.revision == 2
assert "<!-- source:" not in current
assert "/api/v1/reading/materials/" in current
- assert reading.asset_path(
- ready.material_id,
- next((reading._dir(ready.material_id) / "assets").iterdir()).name,
- ) is not None
+ assert (
+ reading.asset_path(
+ ready.material_id,
+ next((reading._dir(ready.material_id) / "assets").iterdir()).name,
+ )
+ is not None
+ )
revisions = reading.revisions(ready.material_id)
assert [row.revision for row in revisions] == [1]
assert "# Old snapshot" in reading.revision_unit_text(ready.material_id, 1, 1)
diff --git a/tests/reading/test_router.py b/tests/reading/test_router.py
index 4785d87de..9183ffa81 100644
--- a/tests/reading/test_router.py
+++ b/tests/reading/test_router.py
@@ -178,9 +178,10 @@ def test_snapshot_assets_are_served_with_sniffed_private_headers(client: TestCli
assert response.headers["content-type"] == "image/png"
assert response.headers["x-content-type-options"] == "nosniff"
assert response.headers["cache-control"].startswith("private")
- assert client.get(
- f"/api/v1/reading/materials/{material_id}/assets/not-an-image.svg"
- ).status_code == 404
+ assert (
+ client.get(f"/api/v1/reading/materials/{material_id}/assets/not-an-image.svg").status_code
+ == 404
+ )
def test_delete_material_is_idempotent_then_404s(client: TestClient) -> None:
diff --git a/tests/services/web_source/test_markdown.py b/tests/services/web_source/test_markdown.py
index 5a703a95e..79a266671 100644
--- a/tests/services/web_source/test_markdown.py
+++ b/tests/services/web_source/test_markdown.py
@@ -47,8 +47,7 @@ async def test_localizes_safe_images_and_never_leaves_failed_hotlinks() -> None:
return None
markdown, assets = await localize_snapshot_images(
- "![Diagram](https://cdn.example.com/ok.png)\n"
- "![Tracker](https://cdn.example.com/bad.svg)",
+ "![Diagram](https://cdn.example.com/ok.png)\n![Tracker](https://cdn.example.com/bad.svg)",
"0123456789abcdef",
fetcher=fetcher,
)