style: apply ruff format across backend + scripts (line-length 100)
Mechanical, whole-tree `ruff format` pass — no behaviour change. Recorded in .git-blame-ignore-revs (next commit) so git blame skips it.
This commit is contained in:
@@ -9,6 +9,7 @@ conversion is provably behaviour-equivalent (concurrency itself can't be exercis
|
||||
|
||||
DB lane (`db` fixture) — skipped without Postgres.
|
||||
"""
|
||||
|
||||
from sqlalchemy import select, text
|
||||
|
||||
from app.downloads import service
|
||||
@@ -31,8 +32,12 @@ def _ref_count(db, asset_id) -> int | None:
|
||||
|
||||
def _holding_asset(db, *, status="ready", ref_count=1, rel_path=None) -> MediaAsset:
|
||||
asset = MediaAsset(
|
||||
source_kind="url", source_ref=f"r{ref_count}-{status}", format_sig="sig",
|
||||
status=status, ref_count=ref_count, rel_path=rel_path,
|
||||
source_kind="url",
|
||||
source_ref=f"r{ref_count}-{status}",
|
||||
format_sig="sig",
|
||||
status=status,
|
||||
ref_count=ref_count,
|
||||
rel_path=rel_path,
|
||||
)
|
||||
db.add(asset)
|
||||
db.flush()
|
||||
@@ -41,8 +46,13 @@ def _holding_asset(db, *, status="ready", ref_count=1, rel_path=None) -> MediaAs
|
||||
|
||||
def _job(db, user_id, asset_id, status="done") -> DownloadJob:
|
||||
j = DownloadJob(
|
||||
user_id=user_id, asset_id=asset_id, source_kind="url", source_ref="r",
|
||||
status=status, queue_pos=1, profile_snapshot={},
|
||||
user_id=user_id,
|
||||
asset_id=asset_id,
|
||||
source_kind="url",
|
||||
source_ref="r",
|
||||
status=status,
|
||||
queue_pos=1,
|
||||
profile_snapshot={},
|
||||
)
|
||||
db.add(j)
|
||||
db.flush()
|
||||
@@ -86,7 +96,9 @@ def test_release_is_a_noop_for_a_non_holding_job(db):
|
||||
|
||||
service.release_asset(db, canceled)
|
||||
db.commit()
|
||||
assert _ref_count(db, asset.id) == 1 # untouched — a canceled job already released while holding
|
||||
assert (
|
||||
_ref_count(db, asset.id) == 1
|
||||
) # untouched — a canceled job already released while holding
|
||||
|
||||
|
||||
def test_release_never_drives_ref_count_negative(db):
|
||||
|
||||
Reference in New Issue
Block a user