mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 01:04:29 +03:00
Changed file opening in tests to use with
This commit is contained in:
parent
751a6d1c2d
commit
c10ad19a2b
|
@ -505,7 +505,7 @@ class TestFilePng(PillowTestCase):
|
|||
im.convert("P").save(test_file, dpi=(100, 100))
|
||||
|
||||
chunks = []
|
||||
fp = open(test_file, "rb")
|
||||
with open(test_file, "rb") as fp:
|
||||
fp.read(8)
|
||||
png = PngImagePlugin.PngStream(fp)
|
||||
while True:
|
||||
|
|
|
@ -495,7 +495,7 @@ class TestFileTiff(PillowTestCase):
|
|||
with Image.open("Tests/images/uint16_1_4660.tif") as im:
|
||||
im.save(tmpfile)
|
||||
|
||||
f = open(tmpfile, 'rb')
|
||||
with open(tmpfile, 'rb') as f:
|
||||
im = Image.open(f)
|
||||
fp = im.fp
|
||||
self.assertFalse(fp.closed)
|
||||
|
|
|
@ -9,7 +9,7 @@ class TestFontBdf(PillowTestCase):
|
|||
|
||||
def test_sanity(self):
|
||||
|
||||
test_file = open(filename, "rb")
|
||||
with open(filename, "rb") as test_file:
|
||||
font = BdfFontFile.BdfFontFile(test_file)
|
||||
|
||||
self.assertIsInstance(font, FontFile.FontFile)
|
||||
|
|
|
@ -17,7 +17,7 @@ class TestFontPcf(PillowTestCase):
|
|||
self.skipTest("zlib support not available")
|
||||
|
||||
def save_font(self):
|
||||
test_file = open(fontname, "rb")
|
||||
with open(fontname, "rb") as test_file:
|
||||
font = PcfFontFile.PcfFontFile(test_file)
|
||||
self.assertIsInstance(font, FontFile.FontFile)
|
||||
self.assertEqual(len([_f for _f in font.glyph if _f]), 192)
|
||||
|
|
Loading…
Reference in New Issue
Block a user