mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Updated test
This commit is contained in:
parent
e01081bf8b
commit
b304a13bca
|
@ -328,17 +328,27 @@ class TestCffi(AccessTest):
|
|||
|
||||
|
||||
class TestImagePutPixelError(AccessTest):
|
||||
IMAGE_MODES = ["L", "LA", "RGB", "RGBA", "I", "I;16", "BGR;15"]
|
||||
IMAGE_MODES1 = ["L", "LA", "RGB", "RGBA"]
|
||||
IMAGE_MODES2 = ["I", "I;16", "BGR;15"]
|
||||
INVALID_TYPES = ["foo", 1.0, None]
|
||||
|
||||
@pytest.mark.parametrize("mode", IMAGE_MODES)
|
||||
def test_putpixel_type_error(self, mode):
|
||||
@pytest.mark.parametrize("mode", IMAGE_MODES1)
|
||||
def test_putpixel_type_error1(self, mode):
|
||||
im = hopper(mode)
|
||||
for v in self.INVALID_TYPES:
|
||||
with pytest.raises(TypeError, match="color must be int or tuple"):
|
||||
im.putpixel((0, 0), v)
|
||||
|
||||
@pytest.mark.parametrize("mode", IMAGE_MODES)
|
||||
@pytest.mark.parametrize("mode", IMAGE_MODES2)
|
||||
def test_putpixel_type_error2(self, mode):
|
||||
im = hopper(mode)
|
||||
for v in self.INVALID_TYPES:
|
||||
with pytest.raises(
|
||||
TypeError, match="color must be int or single-element tuple"
|
||||
):
|
||||
im.putpixel((0, 0), v)
|
||||
|
||||
@pytest.mark.parametrize("mode", IMAGE_MODES1 + IMAGE_MODES2)
|
||||
def test_putpixel_overflow_error(self, mode):
|
||||
im = hopper(mode)
|
||||
with pytest.raises(OverflowError):
|
||||
|
|
Loading…
Reference in New Issue
Block a user