diff --git a/Tests/test_file_apng.py b/Tests/test_file_apng.py index b9918c22d..bda3f8089 100644 --- a/Tests/test_file_apng.py +++ b/Tests/test_file_apng.py @@ -674,6 +674,10 @@ def test_save_all_progress() -> None: progress = [] def callback(state): + if state["image_filename"]: + state["image_filename"] = ( + state["image_filename"].replace("\\", "/").split("Tests/images/")[-1] + ) progress.append(state) Image.new("RGB", (1, 1)).save(out, "PNG", save_all=True, progress=callback) @@ -700,7 +704,7 @@ def test_save_all_progress() -> None: expected.append( { "image_index": i, - "image_filename": "Tests/images/apng/single_frame.png", + "image_filename": "apng/single_frame.png", "completed_frames": i + 1, "total_frames": 7, } @@ -709,7 +713,7 @@ def test_save_all_progress() -> None: expected.append( { "image_index": 2, - "image_filename": "Tests/images/apng/delay.png", + "image_filename": "apng/delay.png", "completed_frames": i + 3, "total_frames": 7, } diff --git a/Tests/test_file_gif.py b/Tests/test_file_gif.py index 9ab843ec0..f38b25886 100644 --- a/Tests/test_file_gif.py +++ b/Tests/test_file_gif.py @@ -297,6 +297,10 @@ def test_save_all_progress(): progress = [] def callback(state): + if state["image_filename"]: + state["image_filename"] = ( + state["image_filename"].replace("\\", "/").split("Tests/images/")[-1] + ) progress.append(state) Image.new("RGB", (1, 1)).save(out, "GIF", save_all=True, progress=callback) @@ -328,7 +332,7 @@ def test_save_all_progress(): expected.append( { "image_index": 1, - "image_filename": "Tests/images/chi.gif", + "image_filename": "chi.gif", "completed_frames": i + 2, "total_frames": 32, } diff --git a/Tests/test_file_mpo.py b/Tests/test_file_mpo.py index f7e82addf..e6d9639ea 100644 --- a/Tests/test_file_mpo.py +++ b/Tests/test_file_mpo.py @@ -288,6 +288,10 @@ def test_save_all_progress(): progress = [] def callback(state): + if state["image_filename"]: + state["image_filename"] = ( + state["image_filename"].replace("\\", "/").split("Tests/images/")[-1] + ) progress.append(state) Image.new("RGB", (1, 1)).save(out, "MPO", save_all=True, progress=callback) @@ -308,9 +312,7 @@ def test_save_all_progress(): im.save(out, "MPO", save_all=True, append_images=[im2], progress=callback) expected = [] - for i, filename in enumerate( - ["Tests/images/sugarshack.mpo", "Tests/images/frozenpond.mpo"] - ): + for i, filename in enumerate(["sugarshack.mpo", "frozenpond.mpo"]): for j in range(2): expected.append( { diff --git a/Tests/test_file_pdf.py b/Tests/test_file_pdf.py index 0b28760be..49049dab9 100644 --- a/Tests/test_file_pdf.py +++ b/Tests/test_file_pdf.py @@ -177,6 +177,10 @@ def test_save_all_progress() -> None: progress = [] def callback(state): + if state["image_filename"]: + state["image_filename"] = ( + state["image_filename"].replace("\\", "/").split("Tests/images/")[-1] + ) progress.append(state) Image.new("RGB", (1, 1)).save(out, "PDF", save_all=True, progress=callback) @@ -197,9 +201,7 @@ def test_save_all_progress() -> None: im.save(out, "PDF", save_all=True, append_images=[im2], progress=callback) expected = [] - for i, filename in enumerate( - ["Tests/images/sugarshack.mpo", "Tests/images/frozenpond.mpo"] - ): + for i, filename in enumerate(["sugarshack.mpo", "frozenpond.mpo"]): for j in range(2): expected.append( { diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index a30c362e4..38c89c867 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -704,6 +704,12 @@ class TestFileTiff: progress = [] def callback(state): + if state["image_filename"]: + state["image_filename"] = ( + state["image_filename"] + .replace("\\", "/") + .split("Tests/images/")[-1] + ) progress.append(state) Image.new("RGB", (1, 1)).save(out, "TIFF", save_all=True, progress=callback) @@ -728,7 +734,7 @@ class TestFileTiff: expected = [ { "image_index": 0, - "image_filename": "Tests/images/hopper.tif", + "image_filename": "hopper.tif", "completed_frames": 1, "total_frames": 4, } @@ -737,7 +743,7 @@ class TestFileTiff: expected.append( { "image_index": 1, - "image_filename": "Tests/images/multipage.tiff", + "image_filename": "multipage.tiff", "completed_frames": i + 2, "total_frames": 4, } diff --git a/Tests/test_file_webp.py b/Tests/test_file_webp.py index 283179451..1595be59a 100644 --- a/Tests/test_file_webp.py +++ b/Tests/test_file_webp.py @@ -131,6 +131,12 @@ class TestFileWebp: progress = [] def callback(state): + if state["image_filename"]: + state["image_filename"] = ( + state["image_filename"] + .replace("\\", "/") + .split("Tests/images/")[-1] + ) progress.append(state) Image.new("RGB", (1, 1)).save(out, "WEBP", save_all=True, progress=callback) @@ -155,7 +161,7 @@ class TestFileWebp: expected.append( { "image_index": 0, - "image_filename": "Tests/images/iss634.webp", + "image_filename": "iss634.webp", "completed_frames": i + 1, "total_frames": 43, }