mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 16:07:30 +03:00 
			
		
		
		
	Merge pull request #1014 from hugovk/unused_var
Remove unused variable, and other minor flake8 warnings
This commit is contained in:
		
						commit
						e0b94d65be
					
				|  | @ -5,6 +5,7 @@ import io | ||||||
| 
 | 
 | ||||||
| from PIL import Image, TiffImagePlugin | from PIL import Image, TiffImagePlugin | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| class LibTiffTestCase(PillowTestCase): | class LibTiffTestCase(PillowTestCase): | ||||||
| 
 | 
 | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|  | @ -32,6 +33,7 @@ class LibTiffTestCase(PillowTestCase): | ||||||
|         out = self.tempfile("temp.png") |         out = self.tempfile("temp.png") | ||||||
|         im.save(out) |         im.save(out) | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| class TestFileLibTiff(LibTiffTestCase): | class TestFileLibTiff(LibTiffTestCase): | ||||||
| 
 | 
 | ||||||
|     def test_g4_tiff(self): |     def test_g4_tiff(self): | ||||||
|  | @ -288,7 +290,7 @@ class TestFileLibTiff(LibTiffTestCase): | ||||||
|         im2 = Image.open(out) |         im2 = Image.open(out) | ||||||
|         self.assert_image_equal(im, im2) |         self.assert_image_equal(im, im2) | ||||||
| 
 | 
 | ||||||
|     def xtest_bw_compression_wRGB(self): |     def xtest_bw_compression_w_rgb(self): | ||||||
|         """ This test passes, but when running all tests causes a failure due |         """ This test passes, but when running all tests causes a failure due | ||||||
|             to output on stderr from the error thrown by libtiff. We need to |             to output on stderr from the error thrown by libtiff. We need to | ||||||
|             capture that but not now""" |             capture that but not now""" | ||||||
|  | @ -319,19 +321,19 @@ class TestFileLibTiff(LibTiffTestCase): | ||||||
|         # file is a multipage tiff,  10x10 green, 10x10 red, 20x20 blue |         # file is a multipage tiff,  10x10 green, 10x10 red, 20x20 blue | ||||||
| 
 | 
 | ||||||
|         im.seek(0) |         im.seek(0) | ||||||
|         self.assertEqual(im.size, (10,10)) |         self.assertEqual(im.size, (10, 10)) | ||||||
|         self.assertEqual(im.convert('RGB').getpixel((0,0)), (0,128,0)) |         self.assertEqual(im.convert('RGB').getpixel((0, 0)), (0, 128, 0)) | ||||||
|         self.assertTrue(im.tag.next) |         self.assertTrue(im.tag.next) | ||||||
| 
 | 
 | ||||||
|         im.seek(1) |         im.seek(1) | ||||||
|         self.assertEqual(im.size, (10,10)) |         self.assertEqual(im.size, (10, 10)) | ||||||
|         self.assertEqual(im.convert('RGB').getpixel((0,0)), (255,0,0)) |         self.assertEqual(im.convert('RGB').getpixel((0, 0)), (255, 0, 0)) | ||||||
|         self.assertTrue(im.tag.next) |         self.assertTrue(im.tag.next) | ||||||
| 
 | 
 | ||||||
|         im.seek(2) |         im.seek(2) | ||||||
|         self.assertFalse(im.tag.next) |         self.assertFalse(im.tag.next) | ||||||
|         self.assertEqual(im.size, (20,20)) |         self.assertEqual(im.size, (20, 20)) | ||||||
|         self.assertEqual(im.convert('RGB').getpixel((0,0)), (0,0,255)) |         self.assertEqual(im.convert('RGB').getpixel((0, 0)), (0, 0, 255)) | ||||||
| 
 | 
 | ||||||
|         TiffImagePlugin.READ_LIBTIFF = False |         TiffImagePlugin.READ_LIBTIFF = False | ||||||
| 
 | 
 | ||||||
|  | @ -360,7 +362,7 @@ class TestFileLibTiff(LibTiffTestCase): | ||||||
|     def test_save_bytesio(self): |     def test_save_bytesio(self): | ||||||
|         # PR 1011 |         # PR 1011 | ||||||
|         # Test TIFF saving to io.BytesIO() object. |         # Test TIFF saving to io.BytesIO() object. | ||||||
|          | 
 | ||||||
|         TiffImagePlugin.WRITE_LIBTIFF = True |         TiffImagePlugin.WRITE_LIBTIFF = True | ||||||
|         TiffImagePlugin.READ_LIBTIFF = True |         TiffImagePlugin.READ_LIBTIFF = True | ||||||
| 
 | 
 | ||||||
|  | @ -368,26 +370,23 @@ class TestFileLibTiff(LibTiffTestCase): | ||||||
|         pilim = hopper() |         pilim = hopper() | ||||||
| 
 | 
 | ||||||
|         def save_bytesio(compression=None): |         def save_bytesio(compression=None): | ||||||
|              | 
 | ||||||
|             testfile = self.tempfile("temp_.tiff".format(compression)) |  | ||||||
|                          |  | ||||||
|             buffer_io = io.BytesIO() |             buffer_io = io.BytesIO() | ||||||
|             pilim.save(buffer_io, format="tiff", compression=compression) |             pilim.save(buffer_io, format="tiff", compression=compression) | ||||||
|             buffer_io.seek(0) |             buffer_io.seek(0) | ||||||
| 
 | 
 | ||||||
|             pilim_load = Image.open(buffer_io) |             pilim_load = Image.open(buffer_io) | ||||||
|             self.assert_image_similar(pilim, pilim_load, 0) |             self.assert_image_similar(pilim, pilim_load, 0) | ||||||
|          | 
 | ||||||
|         # save_bytesio() |         # save_bytesio() | ||||||
|         save_bytesio('raw') |         save_bytesio('raw') | ||||||
|         save_bytesio("packbits") |         save_bytesio("packbits") | ||||||
|         save_bytesio("tiff_lzw") |         save_bytesio("tiff_lzw") | ||||||
|          | 
 | ||||||
|         TiffImagePlugin.WRITE_LIBTIFF = False |         TiffImagePlugin.WRITE_LIBTIFF = False | ||||||
|         TiffImagePlugin.READ_LIBTIFF = False |         TiffImagePlugin.READ_LIBTIFF = False | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| if __name__ == '__main__': | if __name__ == '__main__': | ||||||
|     unittest.main() |     unittest.main() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user