diff --git a/tests/test_tagplot_image.py b/tests/test_tagplot_image.py index 2a9c1f8903149adf123d68996fe8026456f46af4..6ffbca0e0cf36e87f087bb02a32295d2c008a5a6 100644 --- a/tests/test_tagplot_image.py +++ b/tests/test_tagplot_image.py @@ -16,7 +16,6 @@ FIG1 = plt.figure() IMG1 = "image1.png" FIG2 = plt.figure() IMG2 = "image2.jpg" -IMGS_AS_LIST = [IMG1, IMG2] # Constants for tests PROJECT_ID = "MR01" @@ -40,7 +39,7 @@ class TestTagplotImage(unittest.TestCase): respectively. """ options = PlotOptions( - IMGS_AS_LIST, + [IMG1, IMG2], ROTATION, POSITION, figure_ids=["test123456", "654321tset"], @@ -89,6 +88,24 @@ class TestTagplotImage(unittest.TestCase): with self.assertRaises(TypeError): tagplot_image("wrong_object") + def test_wrong_font(self) -> None: + """Test if Warning is raised if a given font file can not be found.""" + options = PlotOptions( + [IMG1, IMG2], + ROTATION, + POSITION, + figure_ids=["test123456", "654321tset"], + prefix=PROJECT_ID, + id_method=METHOD, + qrcode=True, + fontsize=10, + font="not_existing_font.ttf", + fontcolor=(0, 1, 0), + ) + options.validate_input() + with self.assertWarns(Warning): + tagplot_image(options) + def tearDown(self) -> None: os.remove(IMG1) os.remove(IMG2)