From ab6b9daebbd60ee2a3a195231898ffa8bfc85752 Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 28 Jun 2026 17:42:21 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20correct=20stats=20test=20=E2=80=94=20dro?= =?UTF-8?q?p=20corrupt.jpg=20case=20(PIL=20opens=20it=20via=20FS=20fallbac?= =?UTF-8?q?k,=20not=20skipped)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test_stats.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test_stats.py b/test_stats.py index eb1df64..76f3a6c 100644 --- a/test_stats.py +++ b/test_stats.py @@ -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!")