Removed ImageDraw.Draw del calls

This commit is contained in:
Andrew Murray 2017-08-31 21:51:21 +10:00
parent 2ac18689d5
commit 5c2df30ac3
2 changed files with 1 additions and 32 deletions

View File

@ -51,7 +51,6 @@ class TestImageDraw(PillowTestCase):
draw = ImageDraw.Draw(im)
draw.line(((0, 0)), fill=(0, 0, 0))
del draw
def test_mode_mismatch(self):
im = hopper("RGB").copy()
@ -65,7 +64,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.arc(bbox, start, end)
del draw
# Assert
self.assert_image_similar(
@ -88,7 +86,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.arc(BBOX1, start=start, end=end)
del draw
# Assert
self.assert_image_equal(
@ -104,7 +101,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.arc(BBOX1, start=start, end=end)
del draw
# Assert
self.assert_image_similar(
@ -118,7 +114,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.bitmap((10, 10), small)
del draw
# Assert
self.assert_image_equal(
@ -132,7 +127,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.chord(bbox, start, end, fill="red", outline="yellow")
del draw
# Assert
self.assert_image_similar(im, Image.open(expected), 1)
@ -155,7 +149,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.ellipse(bbox, fill="green", outline="blue")
del draw
# Assert
self.assert_image_similar(im, Image.open(expected), 1)
@ -175,7 +168,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.ellipse(((0, 0), (W-1, H)), fill="white")
del draw
# Assert
self.assert_image_similar(
@ -188,7 +180,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.line(points, fill="yellow", width=2)
del draw
# Assert
self.assert_image_equal(
@ -216,7 +207,6 @@ class TestImageDraw(PillowTestCase):
s.line(x0, y0)
draw.shape(s, fill=1)
del draw
# Assert
self.assert_image_equal(
@ -238,7 +228,6 @@ class TestImageDraw(PillowTestCase):
s.line(x0, y0)
draw.shape(s, outline="blue")
del draw
# Assert
self.assert_image_equal(
@ -251,7 +240,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.pieslice(bbox, start, end, fill="white", outline="blue")
del draw
# Assert
self.assert_image_similar(
@ -272,7 +260,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.point(points, fill="yellow")
del draw
# Assert
self.assert_image_equal(
@ -291,7 +278,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.polygon(points, fill="red", outline="blue")
del draw
# Assert
self.assert_image_equal(
@ -315,7 +301,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.polygon(KITE_POINTS, fill="blue", outline="yellow")
del draw
# Assert
self.assert_image_equal(im, Image.open(expected))
@ -327,7 +312,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.rectangle(bbox, fill="black", outline="green")
del draw
# Assert
self.assert_image_equal(
@ -349,7 +333,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.rectangle(bbox, fill="orange")
del draw
# Assert
self.assert_image_similar(im, Image.open(expected), 1)
@ -376,7 +359,6 @@ class TestImageDraw(PillowTestCase):
# Test that filling outside the image does not change the image
ImageDraw.floodfill(im, (W, H), red)
self.assert_image_equal(im, im_floodfill)
del draw
@unittest.skipIf(hasattr(sys, 'pypy_version_info'),
"Causes fatal RPython error on PyPy")
@ -393,7 +375,6 @@ class TestImageDraw(PillowTestCase):
ImageDraw.floodfill(
im, centre_point, ImageColor.getrgb("red"),
border=ImageColor.getrgb("black"))
del draw
# Assert
self.assert_image_equal(
@ -413,7 +394,6 @@ class TestImageDraw(PillowTestCase):
ImageDraw.floodfill(
im, centre_point, ImageColor.getrgb("red"),
thresh=30)
del draw
# Assert
self.assert_image_equal(
@ -576,7 +556,6 @@ class TestImageDraw(PillowTestCase):
# Act
draw.line([(50, 50), (50, 50)], width=3)
del draw
# Assert
self.assert_image_similar(im, Image.open(expected), 1)

View File

@ -141,7 +141,6 @@ class TestImageFont(PillowTestCase):
size = draw.textsize(txt, ttf)
draw.text((10, 10), txt, font=ttf)
draw.rectangle((10, 10, 10 + size[0], 10 + size[1]))
del draw
target = 'Tests/images/rectangle_surrounding_text.png'
target_img = Image.open(target)
@ -188,7 +187,6 @@ class TestImageFont(PillowTestCase):
draw.text((0, 0), TEST_TEXT, fill=None, font=ttf, anchor=None,
spacing=4, align="left")
draw.text((0, 0), TEST_TEXT, None, ttf, None, 4, "left")
del draw
# Test align center and right
for align, ext in {"center": "_center",
@ -196,7 +194,6 @@ class TestImageFont(PillowTestCase):
im = Image.new(mode='RGB', size=(300, 100))
draw = ImageDraw.Draw(im)
draw.multiline_text((0, 0), TEST_TEXT, font=ttf, align=align)
del draw
target = 'Tests/images/multiline_text'+ext+'.png'
target_img = Image.open(target)
@ -221,7 +218,6 @@ class TestImageFont(PillowTestCase):
ttf = self.get_font()
line = "some text"
draw.text((100, 40), line, (0, 0, 0), font=ttf, align='left')
del draw
def test_multiline_size(self):
ttf = self.get_font()
@ -236,7 +232,6 @@ class TestImageFont(PillowTestCase):
# to multiline_textsize()
draw.textsize(TEST_TEXT, font=ttf, spacing=4)
draw.textsize(TEST_TEXT, ttf, 4)
del draw
def test_multiline_width(self):
ttf = self.get_font()
@ -246,7 +241,6 @@ class TestImageFont(PillowTestCase):
self.assertEqual(draw.textsize("longest line", font=ttf)[0],
draw.multiline_textsize("longest line\nline",
font=ttf)[0])
del draw
def test_multiline_spacing(self):
ttf = self.get_font()
@ -254,7 +248,6 @@ class TestImageFont(PillowTestCase):
im = Image.new(mode='RGB', size=(300, 100))
draw = ImageDraw.Draw(im)
draw.multiline_text((0, 0), TEST_TEXT, font=ttf, spacing=10)
del draw
target = 'Tests/images/multiline_text_spacing.png'
target_img = Image.open(target)
@ -279,7 +272,6 @@ class TestImageFont(PillowTestCase):
# Rotated font
draw.font = transposed_font
box_size_b = draw.textsize(word)
del draw
# Check (w,h) of box a is (h,w) of box b
self.assertEqual(box_size_a[0], box_size_b[1])
@ -302,7 +294,6 @@ class TestImageFont(PillowTestCase):
# Rotated font
draw.font = transposed_font
box_size_b = draw.textsize(word)
del draw
# Check boxes a and b are same size
self.assertEqual(box_size_a, box_size_b)
@ -398,7 +389,6 @@ class TestImageFont(PillowTestCase):
# Act
default_font = ImageFont.load_default()
draw.text((10, 10), txt, font=default_font)
del draw
# Assert
self.assert_image_equal(im, target_img)