Skip to content
Snippets Groups Projects
Commit 17311260 authored by Mayr, Hannes's avatar Mayr, Hannes
Browse files

Add unittest for falsely given font file.

parent 313d66c5
No related branches found
No related tags found
5 merge requests!65Release v0.3.0,!64New year developments,!63Improve handling of long IDs,!62Export imported modules,!61Custom IDs
Pipeline #878591 passed
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment