mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	allow lists as arguments for Image.new
This commit is contained in:
		
							parent
							
								
									68a0b5e5a5
								
							
						
					
					
						commit
						c5e111e6b8
					
				| 
						 | 
					@ -1993,7 +1993,7 @@ def _check_size(size):
 | 
				
			||||||
    :returns: True, or raises a ValueError
 | 
					    :returns: True, or raises a ValueError
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if not isinstance(size, tuple):
 | 
					    if not isinstance(size, (list, tuple)):
 | 
				
			||||||
        raise ValueError("Size must be a tuple")
 | 
					        raise ValueError("Size must be a tuple")
 | 
				
			||||||
    if len(size) != 2:
 | 
					    if len(size) != 2:
 | 
				
			||||||
        raise ValueError("Size must be a tuple of length 2")
 | 
					        raise ValueError("Size must be a tuple of length 2")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -247,6 +247,8 @@ class TestImage(PillowTestCase):
 | 
				
			||||||
            Image.new('RGB', (0,0))  # w,h <= 0
 | 
					            Image.new('RGB', (0,0))  # w,h <= 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.assertTrue(Image.new('RGB', (1,1)))
 | 
					        self.assertTrue(Image.new('RGB', (1,1)))
 | 
				
			||||||
 | 
					        # Should pass lists too
 | 
				
			||||||
 | 
					        self.assertTrue(Image.new('RGB', [1,1]))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_storage_neg(self):
 | 
					    def test_storage_neg(self):
 | 
				
			||||||
        # Storage.c accepted negative values for xsize, ysize.  Was
 | 
					        # Storage.c accepted negative values for xsize, ysize.  Was
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user