Added tests

This commit is contained in:
Andrew Murray 2017-08-12 19:07:06 +10:00
parent 25e467a756
commit 7088e1a201

View File

@ -16,6 +16,16 @@ class TestFileFli(PillowTestCase):
self.assertEqual(im.size, (128, 128))
self.assertEqual(im.format, "FLI")
def test_tell(self):
# Arrange
im = Image.open(test_file)
# Act
frame = im.tell()
# Assert
self.assertEqual(frame, 0)
def test_invalid_file(self):
invalid_file = "Tests/images/flower.jpg"
@ -39,6 +49,15 @@ class TestFileFli(PillowTestCase):
except EOFError:
self.assertLess(im.tell(), n_frames)
def test_seek_outside(self):
# Test negative seek
im = Image.open(test_file)
im.seek(-1)
self.assertEqual(im.tell(), 0)
# Test seek past end of file
self.assertRaises(EOFError, lambda: im.seek(2))
if __name__ == '__main__':
unittest.main()