mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-17 02:34:44 +03:00
Merge ba4c14aeac
into e56c3e4d2a
This commit is contained in:
commit
6ca92092a4
|
@ -98,7 +98,8 @@ class ImagePalette(object):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# allocate new color slot
|
# allocate new color slot
|
||||||
if isinstance(self.palette, bytes):
|
if isinstance(self.palette, bytes):
|
||||||
self.palette = [int(x) for x in self.palette]
|
self.palette = [(ord(x) if str is bytes else int(x))
|
||||||
|
for x in self.palette]
|
||||||
index = len(self.colors)
|
index = len(self.colors)
|
||||||
if index >= 256:
|
if index >= 256:
|
||||||
raise ValueError("cannot allocate more than 256 colors")
|
raise ValueError("cannot allocate more than 256 colors")
|
||||||
|
|
BIN
Tests/images/chi.gif
Normal file
BIN
Tests/images/chi.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 84 KiB |
|
@ -52,6 +52,13 @@ class TestImageDraw(PillowTestCase):
|
||||||
self.assertRaises(Exception, lambda: draw.setink(0))
|
self.assertRaises(Exception, lambda: draw.setink(0))
|
||||||
self.assertRaises(Exception, lambda: draw.setfill(0))
|
self.assertRaises(Exception, lambda: draw.setfill(0))
|
||||||
|
|
||||||
|
def test_valueerror(self):
|
||||||
|
im = Image.open("Tests/images/chi.gif")
|
||||||
|
|
||||||
|
draw = ImageDraw.Draw(im)
|
||||||
|
draw.line(((0, 0)), fill=(0, 0, 0))
|
||||||
|
del draw
|
||||||
|
|
||||||
def test_mode_mismatch(self):
|
def test_mode_mismatch(self):
|
||||||
im = hopper("RGB").copy()
|
im = hopper("RGB").copy()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user