From a03a6e2049ceab4b22b1ebf547121a6da65933cd Mon Sep 17 00:00:00 2001 From: hugovk Date: Sat, 4 Mar 2017 23:33:43 +0200 Subject: [PATCH] Test unexpected EOF --- Tests/test_file_xvthumb.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Tests/test_file_xvthumb.py b/Tests/test_file_xvthumb.py index 62b8a2136d9..cdf4bae6af2 100644 --- a/Tests/test_file_xvthumb.py +++ b/Tests/test_file_xvthumb.py @@ -15,9 +15,21 @@ def test_open(self): self.assertEqual(im.format, "XVThumb") self.assert_image_similar(im, hopper("P"), 49) + def test_unexpected_eof(self): + # Test unexpected EOF reading XV thumbnail file + # Arrange + bad_file = "Tests/images/hopper_bad.p7" + + # Act / Assert + self.assertRaises(SyntaxError, + lambda: + XVThumbImagePlugin.XVThumbImageFile(bad_file)) + def test_invalid_file(self): + # Arrange invalid_file = "Tests/images/flower.jpg" + # Act / Assert self.assertRaises(SyntaxError, lambda: XVThumbImagePlugin.XVThumbImageFile(invalid_file))