mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-30 18:53:28 +03:00
Added tests
This commit is contained in:
parent
25e467a756
commit
7088e1a201
|
@ -16,6 +16,16 @@ class TestFileFli(PillowTestCase):
|
||||||
self.assertEqual(im.size, (128, 128))
|
self.assertEqual(im.size, (128, 128))
|
||||||
self.assertEqual(im.format, "FLI")
|
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):
|
def test_invalid_file(self):
|
||||||
invalid_file = "Tests/images/flower.jpg"
|
invalid_file = "Tests/images/flower.jpg"
|
||||||
|
|
||||||
|
@ -39,6 +49,15 @@ class TestFileFli(PillowTestCase):
|
||||||
except EOFError:
|
except EOFError:
|
||||||
self.assertLess(im.tell(), n_frames)
|
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__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user