mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	Tests for #526
This commit is contained in:
		
							parent
							
								
									86ab020736
								
							
						
					
					
						commit
						b73b4a7b63
					
				| 
						 | 
					@ -1,4 +1,5 @@
 | 
				
			||||||
from tester import *
 | 
					from tester import *
 | 
				
			||||||
 | 
					import warnings
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from PIL import Image, TiffImagePlugin
 | 
					from PIL import Image, TiffImagePlugin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,6 +35,7 @@ def test_g4_tiff():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert_equal(im.size, (500,500))
 | 
					    assert_equal(im.size, (500,500))
 | 
				
			||||||
    _assert_noerr(im)
 | 
					    _assert_noerr(im)
 | 
				
			||||||
 | 
					    im = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_g4_large():
 | 
					def test_g4_large():
 | 
				
			||||||
    file = "Tests/images/pport_g4.tif"
 | 
					    file = "Tests/images/pport_g4.tif"
 | 
				
			||||||
| 
						 | 
					@ -295,3 +297,15 @@ def xtest_bw_compression_wRGB():
 | 
				
			||||||
    assert_exception(IOError, lambda: im.save(out, compression='group3'))
 | 
					    assert_exception(IOError, lambda: im.save(out, compression='group3'))
 | 
				
			||||||
    assert_exception(IOError, lambda: im.save(out, compression='group4'))
 | 
					    assert_exception(IOError, lambda: im.save(out, compression='group4'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_fp_leak():
 | 
				
			||||||
 | 
					    import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    im = Image.open("Tests/images/lena_g4_500.tif")
 | 
				
			||||||
 | 
					    fn = im.fp.fileno()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    assert_no_exception(lambda: os.fstat(fn))
 | 
				
			||||||
 | 
					    im.load()  # this should close it. 
 | 
				
			||||||
 | 
					    assert_exception(OSError, lambda: os.fstat(fn)) 
 | 
				
			||||||
 | 
					    im = None  # this should force even more closed.
 | 
				
			||||||
 | 
					    assert_exception(OSError, lambda: os.fstat(fn)) 
 | 
				
			||||||
 | 
					    assert_exception(OSError, lambda: os.close(fn))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user