Use context manager

This commit is contained in:
Andrew Murray 2020-12-30 22:35:54 +11:00
parent 3e9403af56
commit 17c48db318

View File

@ -2,8 +2,8 @@ from PIL import Image
def test_getxmp(): def test_getxmp():
im = Image.open("Tests/images/xmp_test.jpg") with Image.open("Tests/images/xmp_test.jpg") as im:
type_repr = repr(type(im.getxmp())) type_repr = repr(type(im.getxmp()))
assert "dict" in type_repr assert "dict" in type_repr
assert isinstance(im.getxmp()["Description"][0]["Version"], str) assert isinstance(im.getxmp()["Description"][0]["Version"], str)