def test_closes_image_on_exception(self):
        # This tests that willow closes images when the with is exited with an exception
        try:
            with self.image.get_willow_image():
                self.assertFalse(self.image.file.closed)
                raise ValueError("Something went wrong!")
        except __HOLE__:
            pass

        self.assertTrue(self.image.file.closed)
dataset/ETHPy150Open torchbox/wagtail/wagtail/wagtailimages/tests/test_models.py/TestGetWillowImage.test_closes_image_on_exception