mirror of
https://github.com/wiltodelta/remove-ai-watermarks.git
synced 2026-10-14 21:40:47 +02:00
Add post-fill validation for visible watermarks
This commit is contained in:
12 files changed
+498
-29
No files matched your search
@@ -21,6 +21,8 @@ class TestTopLevelExports:
|
||||
from remove_ai_watermarks import openai_provenance
|
||||
|
||||
assert raiw.remove_visible is api.remove_visible
|
||||
assert raiw.remove_visible_detailed is api.remove_visible_detailed
|
||||
assert raiw.VisibleRemovalResult is api.VisibleRemovalResult
|
||||
assert raiw.visible_provenance is api.visible_provenance
|
||||
assert raiw.verify_openai_synthid is openai_provenance.verify_openai_synthid
|
||||
assert raiw.OpenAIProvenanceError is openai_provenance.OpenAIProvenanceError
|
||||
@@ -64,6 +66,16 @@ class TestRemoveVisibleArray:
|
||||
assert removed == []
|
||||
assert result.shape == arr.shape
|
||||
|
||||
def test_detailed_no_mark_result_is_explicit(self):
|
||||
arr = np.zeros((256, 256, 3), np.uint8)
|
||||
|
||||
report = raiw.remove_visible_detailed(arr, backend="cv2")
|
||||
|
||||
assert report.status == "no_watermark"
|
||||
assert report.labels == []
|
||||
assert report.marks == ()
|
||||
assert np.array_equal(report.image, arr)
|
||||
|
||||
def test_bad_source_raises(self, tmp_path):
|
||||
with pytest.raises(ValueError, match="Could not read image"):
|
||||
raiw.remove_visible(tmp_path / "nope.png")
|
||||
@@ -83,6 +95,14 @@ class TestRemoveVisiblePath:
|
||||
result, _ = raiw.remove_visible(DOUBAO, backend="cv2")
|
||||
assert result.ndim == 3
|
||||
|
||||
def test_detailed_result_reports_post_removal_status(self):
|
||||
report = raiw.remove_visible_detailed(DOUBAO, backend="cv2")
|
||||
|
||||
assert report.status == "cleaned"
|
||||
assert any("Doubao" in label for label in report.labels)
|
||||
assert len(report.marks) == 1
|
||||
assert report.marks[0].confidence_after is not None
|
||||
|
||||
|
||||
class TestNoOpPreservesOriginal:
|
||||
def test_no_mark_copies_original_bytes(self, tmp_path):
|
||||
|
||||
Reference in new issue
Block a user