From 6c889d10883d264bd946e37ba081631590a44353 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 15 Jun 2022 21:34:16 +0300 Subject: [PATCH] Test ImageCms.profileToProfile with invalid flags --- Tests/test_imagecms.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Tests/test_imagecms.py b/Tests/test_imagecms.py index 66a72a90e..0c0eb92c4 100644 --- a/Tests/test_imagecms.py +++ b/Tests/test_imagecms.py @@ -210,6 +210,15 @@ def test_invalid_color_temperature(): ImageCms.createProfile("LAB", "invalid") +@pytest.mark.parametrize("flag", ("my string", -1)) +def test_invalid_flag(flag): + with hopper() as im: + with pytest.raises( + ImageCms.PyCMSError, match="flags must be an integer between 0 and " + ): + ImageCms.profileToProfile(im, "foo", "bar", flags=flag) + + def test_simple_lab(): i = Image.new("RGB", (10, 10), (128, 128, 128))