Added type hints to Tests/test_font_*.py by radarhere · Pull Request #7743 · python-pillow/Pillow


def test_leak(self):
def test_leak(self) -> None:
default_font = ImageFont.load_default()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this test is checking for leaks with a PIL font and was also broken by #7354.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've created #7748 for this.

fontname = "Tests/fonts/ter-x20b.pcf"

charsets = {
charsets: dict[str, dict[str, int | str]] = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the assert isinstance(...) calls if you use a TypedDict subclass for the value.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've pushed a commit for this.