From 766a0cc652c693786e6d3f25c624a1f4c8bac405 Mon Sep 17 00:00:00 2001 From: Joachim Date: Thu, 20 Jan 2022 22:19:49 +0100 Subject: [PATCH] Fix tests --- bookwyrm/preview_images.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bookwyrm/preview_images.py b/bookwyrm/preview_images.py index 917d985a2..f48ca15e2 100644 --- a/bookwyrm/preview_images.py +++ b/bookwyrm/preview_images.py @@ -41,12 +41,15 @@ def get_font(weight, size=28): except OSError: font = ImageFont.load_default() - if (weight == 'light'): - font.set_variation_by_name('Light') - if (weight == 'bold'): - font.set_variation_by_name('Bold') - if (weight == 'regular'): - font.set_variation_by_name('Regular') + try: + if weight == "light": + font.set_variation_by_name("Light") + if weight == "bold": + font.set_variation_by_name("Bold") + if weight == "regular": + font.set_variation_by_name("Regular") + except AttributeError: + pass return font