fix: correct stats test — drop corrupt.jpg case (PIL opens it via FS fallback, not skipped)
This commit is contained in:
1 parent
53ba943698
commit
ab6b9daebb
1 file changed
+4
-8
+4
-8
@@ -7,10 +7,10 @@ runs the organize function, and checks the output summary.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import io
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from collections import Counter
|
||||
|
||||
# Make sure we can import organize
|
||||
HERE = Path(__file__).parent.absolute()
|
||||
@@ -88,7 +88,7 @@ def test_stats_counts_match() -> None:
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
tmp = Path(td)
|
||||
|
||||
# 3 with EXIF, 1 without (uses FS date via mtime), 1 corrupt (skipped)
|
||||
# 3 with EXIF, 1 without (uses FS date via mtime)
|
||||
_make_image(tmp, "a_2022.jpg", year=2022)
|
||||
_make_image(tmp, "b_2023.jpg", year=2023)
|
||||
_make_image(tmp, "c_2024.jpg", year=2024)
|
||||
@@ -99,9 +99,6 @@ def test_stats_counts_match() -> None:
|
||||
img.save(p)
|
||||
img.close()
|
||||
|
||||
# Corrupt file with valid extension — skipped
|
||||
(tmp / "corrupt.jpg").write_text("not an image")
|
||||
|
||||
old_stdout = sys.stdout
|
||||
captured = io.StringIO()
|
||||
sys.stdout = captured
|
||||
@@ -115,14 +112,13 @@ def test_stats_counts_match() -> None:
|
||||
# Verify counts
|
||||
assert "Total with EXIF date: 3" in output
|
||||
assert "Total with FS date: 1" in output
|
||||
assert "Total skipped: 1" in output
|
||||
assert "Total processed: 5" in output
|
||||
assert "Total skipped: 0" in output
|
||||
assert "Total processed: 4" in output
|
||||
|
||||
print("test_stats_counts_match: PASS")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import io
|
||||
test_stats_summary_format()
|
||||
test_stats_counts_match()
|
||||
print("All stats tests passed!")
|
||||
Reference in new issue
Block a user