mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	This is Christoph Gohlke's test suite from his personal PIL package found at http://www.lfd.uci.edu/~gohlke/pythonlibs/. This is just to bring it in as a separate commit. Future commits will align it with Pillow.
		
			
				
	
	
		
			26 lines
		
	
	
		
			775 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			775 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from tester import *
 | 
						|
 | 
						|
from PIL import Image
 | 
						|
 | 
						|
filename = "Images/lena.jpg"
 | 
						|
 | 
						|
data = tostring(Image.open(filename).resize((512, 512)), "JPEG")
 | 
						|
 | 
						|
def draft(mode, size):
 | 
						|
    im = fromstring(data)
 | 
						|
    im.draft(mode, size)
 | 
						|
    return im
 | 
						|
 | 
						|
def test_size():
 | 
						|
    assert_equal(draft("RGB", (512, 512)).size, (512, 512))
 | 
						|
    assert_equal(draft("RGB", (256, 256)).size, (256, 256))
 | 
						|
    assert_equal(draft("RGB", (128, 128)).size, (128, 128))
 | 
						|
    assert_equal(draft("RGB", (64, 64)).size, (64, 64))
 | 
						|
    assert_equal(draft("RGB", (32, 32)).size, (64, 64))
 | 
						|
 | 
						|
def test_mode():
 | 
						|
    assert_equal(draft("1", (512, 512)).mode, "RGB")
 | 
						|
    assert_equal(draft("L", (512, 512)).mode, "L")
 | 
						|
    assert_equal(draft("RGB", (512, 512)).mode, "RGB")
 | 
						|
    assert_equal(draft("YCbCr", (512, 512)).mode, "YCbCr")
 |