1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed a couple unclosed file warnings in tests

This commit is contained in:
Tim Graham
2013-09-03 13:37:27 -04:00
parent 3db66b1d65
commit cb98ffe8f4
2 changed files with 6 additions and 4 deletions

View File

@@ -567,9 +567,10 @@ class InconsistentGetImageDimensionsBug(unittest.TestCase):
from django.core.files.images import ImageFile
img_path = os.path.join(os.path.dirname(upath(__file__)), "test.png")
image = ImageFile(open(img_path, 'rb'))
image_pil = Image.open(img_path)
size_1, size_2 = get_image_dimensions(image), get_image_dimensions(image)
with open(img_path, 'rb') as file:
image = ImageFile(file)
image_pil = Image.open(img_path)
size_1, size_2 = get_image_dimensions(image), get_image_dimensions(image)
self.assertEqual(image_pil.size, size_1)
self.assertEqual(size_1, size_2)