diff --git a/Tests/test_imagetk.py b/Tests/test_imagetk.py index b8ca9f122..f6bbe39fd 100644 --- a/Tests/test_imagetk.py +++ b/Tests/test_imagetk.py @@ -7,6 +7,9 @@ from unittest import mock from PIL import Image from PIL import ImageTk +from unittest.mock import patch + + from .helper import assert_image_equal, hopper TK_MODES = ("1", "L", "P", "RGB", "RGBA") @@ -100,14 +103,3 @@ def test_bitmapimage() -> None: # assert_image_equal(reloaded, im) -def test_photoimage_del() -> None: - # Create a dummy PIL image - im = Image.new("RGB", (100, 100)) - - # Create a PhotoImage object - photo = ImageTk.PhotoImage(im) - - # Delete the PhotoImage object - del photo - - # No assertion needed, just ensuring that the __del__ method is executed \ No newline at end of file diff --git a/conftest.py b/conftest.py index dbb166eda..581940539 100644 --- a/conftest.py +++ b/conftest.py @@ -20,7 +20,6 @@ def calculate_coverage(test_name): "branches2": PdfParser.XrefTable.branches, # duru "branches3": SpiderImagePlugin.branches, # isidora "branches4": MpegImagePlugin.BitStream.branches, # isidora - "branches5": ImageTk.BitmapImage.branches, # deekshu "branches6": ImageFile.PyEncoder.branches, # deekshu # Add more } diff --git a/src/PIL/ImageTk.py b/src/PIL/ImageTk.py index ebe33705a..f5ca8862f 100644 --- a/src/PIL/ImageTk.py +++ b/src/PIL/ImageTk.py @@ -31,10 +31,6 @@ from io import BytesIO from . import Image -branches = { - "1": False, - "2": False, -} # -------------------------------------------------------------------- # Check for Tkinter interface hooks @@ -192,10 +188,7 @@ class PhotoImage: class BitmapImage: - branches = { - "1": False, - "2": False, -} + """ A Tkinter-compatible bitmap image. This can be used everywhere Tkinter expects an image object. @@ -231,10 +224,8 @@ class BitmapImage: name = self.__photo.name self.__photo.name = None try: - BitmapImage.branches["1"] = True self.__photo.tk.call("image", "delete", name) except Exception: - BitmapImage.branches["2"] = True pass # ignore internal errors def width(self) -> int: