Linting changes

This commit is contained in:
Riley Lahd 2019-03-14 14:51:13 -06:00
parent 53cfd19a44
commit 85a07bb385
2 changed files with 11 additions and 18 deletions

View File

@ -327,9 +327,8 @@ class TestFileGif(PillowTestCase):
# Red circle in center of each frame
for img in im_list:
d = ImageDraw.Draw(img)
d.ellipse([(40,40),(60,60)], fill='#f00')
d.ellipse([(40, 40), (60, 60)], fill='#f00')
# check per frame disposal
im_list[0].save(
out,
save_all=True,
@ -341,27 +340,20 @@ class TestFileGif(PillowTestCase):
top_left_pixels = []
center_pixels = []
# # Get pixel in top left
# rgb_img = img.convert('RGB')
# r, g, b = rgb_img.getpixel((1,1))
# top_left_pixels += [(r,g,b)]
# r, g, b = rgb_img.getpixel((50,50))
# center_pixels += [(r,g,b)]
for i in range(3):
rgb_img = img.convert('RGB')
# Get pixel in top left
r, g, b = rgb_img.getpixel((1,1))
top_left_pixels += [(r,g,b)]
r, g, b = rgb_img.getpixel((1, 1))
top_left_pixels += [(r, g, b)]
# Get pixel in center
r, g, b = rgb_img.getpixel((50,50))
center_pixels += [(r,g,b)]
r, g, b = rgb_img.getpixel((50, 50))
center_pixels += [(r, g, b)]
for prev in top_left_pixels[:i]:
# Change background every frame
self.assertNotEqual((r,g,b), prev)
self.assertNotEqual((r, g, b), prev)
for prev in center_pixels[:i]:
# Center remains red every frame
self.assertEqual((r,g,b), (255,0,0))
self.assertEqual((r, g, b), (255, 0, 0))
img.seek(img.tell() + 1)
def test_iss634(self):

View File

@ -476,8 +476,8 @@ def _write_multiple_frames(im, fp, palette):
if len(im_frames) > 1:
for frame_data in im_frames:
im_frame = frame_data['im']
if("disposal" in frame_data["encoderinfo"] \
and frame_data["encoderinfo"]["disposal"]==2):
if("disposal" in frame_data["encoderinfo"]
and frame_data["encoderinfo"]["disposal"] == 2):
frame_data['encoderinfo']['include_color_table'] = True
if not frame_data['bbox']:
# global header
@ -589,7 +589,8 @@ def _write_local_header(fp, im, offset, flags):
if include_color_table:
palette_bytes = _get_palette_bytes(im)
# If needed, expand palette to minimum size
while(len(palette_bytes)<9): palette_bytes = palette_bytes*2
while(len(palette_bytes) < 9):
palette_bytes = palette_bytes*2
color_table_size = _get_color_table_size(palette_bytes)
if color_table_size:
flags = flags | 128 # local color table flag