chore: audit RF4 media quality
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s

This commit is contained in:
ik
2026-09-14 22:25:45 +07:00
parent b47a6cc366
commit 7d009c932f
5 changed files with 68 additions and 3 deletions
+15 -1
View File
@@ -6,7 +6,7 @@ import io
import pytest
from PIL import Image
from rf4_research.media_assets import approve_stored_assets, audit_media_catalog, extract_media_candidates, inspect_image, media_coverage, merge_manifest, reconcile_queued_duplicates, review_asset, store_asset
from rf4_research.media_assets import approve_stored_assets, audit_media_catalog, extract_media_candidates, inspect_image, media_coverage, media_quality_report, merge_manifest, reconcile_queued_duplicates, review_asset, store_asset
def test_extracts_and_classifies_unique_https_media() -> None:
@@ -179,3 +179,17 @@ def test_bulk_approval_only_publishes_stored_assets(tmp_path: Path) -> None:
assert assets[0]["entity_key"] == "fish:pike"
assert assets[0]["review_note"] == "owner approved"
assert assets[1]["status"] == "queued"
def test_quality_report_finds_low_resolution_asset_and_known_alternative(tmp_path: Path) -> None:
(tmp_path / "manifest.json").write_text(json.dumps({"assets": [
{"entity_type": "fish", "label": "Щука", "status": "approved", "asset_url": "https://small.example/pike.png", "width": 48, "height": 48},
{"entity_type": "fish", "label": "Щука", "status": "duplicate", "asset_url": "https://large.example/pike.webp", "duplicate_of": "https://small.example/pike.png"},
{"entity_type": "fish", "label": "Окунь", "status": "approved", "asset_url": "https://large.example/perch.webp", "width": 1024, "height": 1024},
]}), encoding="utf-8")
report = media_quality_report(tmp_path)
assert (report["published"], report["below_minimum"], report["upsampled_in_cards"]) == (2, 1, 1)
assert report["known_alternative_urls"] == 1
assert report["by_source"]["small.example"]["below_minimum"] == 1