mirror of
https://github.com/wiltodelta/remove-ai-watermarks.git
synced 2026-08-31 09:40:38 +02:00
Harden scale-registered SynthID detection
This commit is contained in:
@@ -741,6 +741,7 @@ class TestDetectSynthIDCommand:
|
||||
result = runner.invoke(main, ["detect-synthid", "--help"])
|
||||
assert result.exit_code == 0
|
||||
assert "calibrated image sizes" in result.output
|
||||
assert "--register-scale" in result.output
|
||||
|
||||
def test_unsupported_geometry_is_machine_readable(self, runner, tmp_clean_png):
|
||||
result = runner.invoke(main, ["detect-synthid", str(tmp_clean_png), "--json"])
|
||||
@@ -750,6 +751,23 @@ class TestDetectSynthIDCommand:
|
||||
assert payload["status"] == "unsupported"
|
||||
assert payload["score"] is None
|
||||
|
||||
def test_registered_scale_mode_is_machine_readable(self, runner, tmp_clean_png):
|
||||
from remove_ai_watermarks.synthid_detector import (
|
||||
REGISTERED_DETECTOR_ID,
|
||||
REGISTERED_THRESHOLD,
|
||||
)
|
||||
|
||||
result = runner.invoke(
|
||||
main,
|
||||
["detect-synthid", str(tmp_clean_png), "--register-scale", "--json"],
|
||||
)
|
||||
|
||||
assert result.exit_code == 0, result.output
|
||||
payload = json.loads(result.output)
|
||||
assert payload["status"] == "unsupported"
|
||||
assert payload["threshold"] == REGISTERED_THRESHOLD
|
||||
assert payload["detector"] == REGISTERED_DETECTOR_ID
|
||||
|
||||
def test_non_json_output_preserves_negative_scope(self, runner, tmp_clean_png):
|
||||
result = runner.invoke(main, ["detect-synthid", str(tmp_clean_png)])
|
||||
|
||||
@@ -757,6 +775,15 @@ class TestDetectSynthIDCommand:
|
||||
assert "unsupported" in result.output
|
||||
assert "not proof that SynthID is absent" in result.output
|
||||
|
||||
def test_registered_non_json_output_names_the_bounded_search(self, runner, tmp_clean_png):
|
||||
result = runner.invoke(
|
||||
main,
|
||||
["detect-synthid", str(tmp_clean_png), "--register-scale"],
|
||||
)
|
||||
|
||||
assert result.exit_code == 0, result.output
|
||||
assert "Bounded spatial-scale registration was enabled" in result.output
|
||||
|
||||
|
||||
class TestBatchCommand:
|
||||
"""Tests for the 'batch' subcommand."""
|
||||
|
||||
Reference in New Issue
Block a user