Apply suggestions from code review

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
This commit is contained in:
nulano 2020-10-11 22:25:16 +02:00 committed by GitHub
parent 786eaf11e2
commit b85fabca70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -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):

View File

@ -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)