Files
remove-ai-watermarks/tests/test_publish_source_classify_hf.py
T
Victor KuznetsovandClaude Opus 5.5 1dc70df289 Upgrade to OpenCV 5 with frozen Hershey templates and tighten video marks
- Lock OpenCV 5 and cap NumPy below 2.4 through uv constraint-dependencies so
  PaddleX 3.7 keeps resolving; Dependabot ignores mirror the cap.
- OpenCV 5 draws Hershey putText glyphs differently, so the Dola and Kling
  video templates ship as committed OpenCV 4 renders with a recipe script, and
  the OpenArt alpha recipe now refuses any OpenCV but 4.x.
- Break Sora/Veo cross-matches in favor of Veo under valid Google AI-video
  provenance, and require the full Sora mascot shape for mascot-only matches.
- Let the Doubao engine detect marks tinted by saturated backgrounds.
- Share C2PA claim-generator, credential-level and vendor-platform helpers,
  JPEG suffixes and the DCT basis instead of per-module copies.
- Log model download failures, document the optional GITHUB_TOKEN, mark the
  photo and source classifier model cards archived, and refresh the lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 19:19:00 -07:00

42 lines
1.4 KiB
Python

"""Local staging checks for the source-classifier Hub publisher."""
from __future__ import annotations
import json
import sys
from pathlib import Path
import pytest
SCRIPTS = Path(__file__).resolve().parents[1] / "scripts"
sys.path.insert(0, str(SCRIPTS))
import publish_source_classify_hf as publish # noqa: E402
def test_hub_ids_match_the_runtime_loader() -> None:
# The workflow runs this script with --no-project, so it cannot import the package constants.
from remove_ai_watermarks.source_classify import MODEL_FILE, WEIGHTS_REPO
assert publish.HUB_REPO == WEIGHTS_REPO
assert publish.MODEL_FILE == MODEL_FILE
def test_stage_release_copies_only_public_artifacts(tmp_path: Path) -> None:
source = tmp_path / "source"
source.mkdir()
(source / "source-pipeline-mlp.npz").write_bytes(b"weights")
destination = tmp_path / "stage"
publish.stage_release(destination, source)
assert sorted(path.name for path in destination.iterdir()) == sorted(publish.PUBLIC_FILES)
def test_stage_release_requires_the_model(tmp_path: Path) -> None:
with pytest.raises(SystemExit, match=r"source-pipeline-mlp\.npz"):
publish.stage_release(tmp_path / "stage", tmp_path)
def test_card_sha_matches_the_metrics_manifest() -> None:
metrics = json.loads((publish.CARD_DIR / "metrics.json").read_text())
card = (publish.CARD_DIR / "README.md").read_text()
assert metrics["artifact_sha256"] in card