From 6696b780e3b38672106c12be12e82f195c93b71a Mon Sep 17 00:00:00 2001 From: wiredfool Date: Tue, 30 Dec 2014 16:57:24 -0800 Subject: [PATCH] Test style cleanup --- Tests/check_png_dos.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Tests/check_png_dos.py b/Tests/check_png_dos.py index 8f974d293..c74990a8c 100644 --- a/Tests/check_png_dos.py +++ b/Tests/check_png_dos.py @@ -1,23 +1,22 @@ from helper import unittest, PillowTestCase -import sys from PIL import Image, PngImagePlugin from io import BytesIO import zlib -test_file = "Tests/images/png_decompression_dos.png" +TEST_FILE = "Tests/images/png_decompression_dos.png" class TestPngDos(PillowTestCase): def test_dos_text(self): try: - im = Image.open(test_file) + im = Image.open(TEST_FILE) im.load() except ValueError as msg: - self.assert_(msg, "Decompressed Data Too Large") + self.assertTrue(msg, "Decompressed Data Too Large") return for s in im.text.values(): - self.assert_(len(s) < 1024*1024, "Text chunk larger than 1M") + self.assertLess(len(s), 1024*1024, "Text chunk larger than 1M") def test_dos_total_memory(self): im = Image.new('L',(1,1)) @@ -36,13 +35,13 @@ class TestPngDos(PillowTestCase): try: im2 = Image.open(b) except ValueError as msg: - self.assert_("Too much memory" in msg) + self.assertIn("Too much memory", msg) return total_len = 0 for txt in im2.text.values(): total_len += len(txt) - self.assert_(total_len < 64*1024*1024) + self.assertLess(total_len, 64*1024*1024, "Total text chunks greater than 64M") if __name__ == '__main__': unittest.main()