added test for reading TIFF from non-disk file obj

This commit is contained in:
chadawagner 2019-08-02 17:26:10 -07:00 committed by Andrew Murray
parent 597ca79b1b
commit 457a97dde8

View File

@ -81,6 +81,19 @@ class TestFileLibTiff(LibTiffTestCase):
self.assertEqual(im.size, (500, 500))
self._assert_noerr(im)
def test_g4_non_disk_file_object(self):
"""Testing loading from non-disk non-bytesio file object"""
test_file = "Tests/images/hopper_g4_500.tif"
s = io.BytesIO()
with open(test_file, "rb") as f:
s.write(f.read())
s.seek(0)
r = io.BufferedReader(s)
im = Image.open(r)
self.assertEqual(im.size, (500, 500))
self._assert_noerr(im)
def test_g4_eq_png(self):
""" Checking that we're actually getting the data that we expect"""
png = Image.open("Tests/images/hopper_bw_500.png")