mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-30 01:43:17 +03:00
Merge pull request #2149 from uploadcare/new-images-with-list
Allow lists as arguments for Image.new()
This commit is contained in:
commit
e258baf30c
|
@ -1993,7 +1993,7 @@ def _check_size(size):
|
|||
:returns: True, or raises a ValueError
|
||||
"""
|
||||
|
||||
if not isinstance(size, tuple):
|
||||
if not isinstance(size, (list, tuple)):
|
||||
raise ValueError("Size must be a tuple")
|
||||
if len(size) != 2:
|
||||
raise ValueError("Size must be a tuple of length 2")
|
||||
|
|
|
@ -247,6 +247,9 @@ class TestImage(PillowTestCase):
|
|||
Image.new('RGB', (0,0)) # w,h <= 0
|
||||
|
||||
self.assertTrue(Image.new('RGB', (1,1)))
|
||||
# Should pass lists too
|
||||
i = Image.new('RGB', [1,1])
|
||||
self.assertEqual(type(i.size), tuple)
|
||||
|
||||
def test_storage_neg(self):
|
||||
# Storage.c accepted negative values for xsize, ysize. Was
|
||||
|
|
Loading…
Reference in New Issue
Block a user