mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			946 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			946 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import pytest
 | 
						|
 | 
						|
from PIL import FtexImagePlugin, Image
 | 
						|
 | 
						|
from .helper import assert_image_equal_tofile, assert_image_similar
 | 
						|
 | 
						|
 | 
						|
def test_load_raw():
 | 
						|
    with Image.open("Tests/images/ftex_uncompressed.ftu") as im:
 | 
						|
        assert_image_equal_tofile(im, "Tests/images/ftex_uncompressed.png")
 | 
						|
 | 
						|
 | 
						|
def test_load_dxt1():
 | 
						|
    with Image.open("Tests/images/ftex_dxt1.ftc") as im:
 | 
						|
        with Image.open("Tests/images/ftex_dxt1.png") as target:
 | 
						|
            assert_image_similar(im, target.convert("RGBA"), 15)
 | 
						|
 | 
						|
 | 
						|
def test_invalid_file():
 | 
						|
    invalid_file = "Tests/images/flower.jpg"
 | 
						|
 | 
						|
    with pytest.raises(SyntaxError):
 | 
						|
        FtexImagePlugin.FtexImageFile(invalid_file)
 | 
						|
 | 
						|
 | 
						|
def test_constants_deprecation():
 | 
						|
    for enum, prefix in {
 | 
						|
        FtexImagePlugin.Format: "FORMAT_",
 | 
						|
    }.items():
 | 
						|
        for name in enum.__members__:
 | 
						|
            with pytest.warns(DeprecationWarning):
 | 
						|
                assert getattr(FtexImagePlugin, prefix + name) == enum[name]
 |