1
from __future__ import annotations
8
def test_setmode() -> None:
9
im = Image.new("L", (1, 1), 255)
11
assert im.im.getpixel((0, 0)) == 255
13
assert im.im.getpixel((0, 0)) == 255
15
im = Image.new("1", (1, 1), 1)
17
assert im.im.getpixel((0, 0)) == 255
19
assert im.im.getpixel((0, 0)) == 255
21
im = Image.new("RGB", (1, 1), (1, 2, 3))
23
assert im.im.getpixel((0, 0)) == (1, 2, 3)
25
assert im.im.getpixel((0, 0)) == (1, 2, 3, 255)
27
assert im.im.getpixel((0, 0)) == (1, 2, 3, 255)
29
assert im.im.getpixel((0, 0)) == (1, 2, 3)
31
with pytest.raises(ValueError):
33
with pytest.raises(ValueError):
34
im.im.setmode("RGBABCDE")