From b85fabca70a7f34f2763c6225fd28792a013e764 Mon Sep 17 00:00:00 2001 From: nulano Date: Sun, 11 Oct 2020 22:25:16 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Hugo van Kemenade --- Tests/test_imagefont.py | 14 +++++++------- docs/reference/ImageDraw.rst | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py index 96cab5c4a..51d94dd8c 100644 --- a/Tests/test_imagefont.py +++ b/Tests/test_imagefont.py @@ -845,12 +845,12 @@ class TestImageFont: ttf = ImageFont.truetype(FONT_PATH, 40, layout_engine=self.LAYOUT_ENGINE) ttf.getsize(txt) - img = Image.new("RGB", (300, 64), "white") - d = ImageDraw.Draw(img) + im = Image.new("RGB", (300, 64), "white") + d = ImageDraw.Draw(im) d.text((10, 10), txt, font=ttf, fill="#fa6", embedded_color=True) with Image.open("Tests/images/standard_embedded.png") as expected: - assert_image_similar(img, expected, max(self.metrics["multiline"], 3)) + assert_image_similar(im, expected, max(self.metrics["multiline"], 3)) @pytest.mark.xfail(is_pypy(), reason="failing on PyPy with Raqm") def test_cbdt(self): @@ -870,8 +870,8 @@ class TestImageFont: with Image.open("Tests/images/cbdt_notocoloremoji.png") as expected: assert_image_similar(im, expected, self.metrics["multiline"]) - except IOError as ex: - assert str(ex) in ("unimplemented feature", "unknown file format") + except IOError as e: + assert str(e) in ("unimplemented feature", "unknown file format") pytest.skip("freetype compiled without libpng or unsupported") @pytest.mark.xfail(is_pypy(), reason="failing on PyPy with Raqm") @@ -892,8 +892,8 @@ class TestImageFont: with Image.open("Tests/images/cbdt_notocoloremoji_mask.png") as expected: assert_image_similar(im, expected, self.metrics["multiline"]) - except IOError as ex: - assert str(ex) in ("unimplemented feature", "unknown file format") + except IOError as e: + assert str(e) in ("unimplemented feature", "unknown file format") pytest.skip("freetype compiled without libpng or unsupported") def test_colr(self): diff --git a/docs/reference/ImageDraw.rst b/docs/reference/ImageDraw.rst index 789641223..333768885 100644 --- a/docs/reference/ImageDraw.rst +++ b/docs/reference/ImageDraw.rst @@ -415,7 +415,7 @@ Methods :param embedded_color: Whether to use font embedded color glyphs (COLR or CBDT). - .. versionadded:: 8.0.0 + .. versionadded:: 8.0.0 .. py:method:: ImageDraw.textsize(text, font=None, spacing=4, direction=None, features=None, language=None, stroke_width=0)