mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-15 06:07:33 +03:00
Merge pull request #8459 from radarhere/webp
This commit is contained in:
commit
08b561e25d
|
@ -56,17 +56,17 @@ def test_version() -> None:
|
||||||
|
|
||||||
def test_webp_transparency() -> None:
|
def test_webp_transparency() -> None:
|
||||||
with pytest.warns(DeprecationWarning):
|
with pytest.warns(DeprecationWarning):
|
||||||
assert features.check("transp_webp") == features.check_module("webp")
|
assert (features.check("transp_webp") or False) == features.check_module("webp")
|
||||||
|
|
||||||
|
|
||||||
def test_webp_mux() -> None:
|
def test_webp_mux() -> None:
|
||||||
with pytest.warns(DeprecationWarning):
|
with pytest.warns(DeprecationWarning):
|
||||||
assert features.check("webp_mux") == features.check_module("webp")
|
assert (features.check("webp_mux") or False) == features.check_module("webp")
|
||||||
|
|
||||||
|
|
||||||
def test_webp_anim() -> None:
|
def test_webp_anim() -> None:
|
||||||
with pytest.warns(DeprecationWarning):
|
with pytest.warns(DeprecationWarning):
|
||||||
assert features.check("webp_anim") == features.check_module("webp")
|
assert (features.check("webp_anim") or False) == features.check_module("webp")
|
||||||
|
|
||||||
|
|
||||||
@skip_unless_feature("libjpeg_turbo")
|
@skip_unless_feature("libjpeg_turbo")
|
||||||
|
|
|
@ -146,10 +146,11 @@ def check_feature(feature: str) -> bool | None:
|
||||||
|
|
||||||
module, flag, ver = features[feature]
|
module, flag, ver = features[feature]
|
||||||
|
|
||||||
|
if isinstance(flag, bool):
|
||||||
|
deprecate(f'check_feature("{feature}")', 12)
|
||||||
try:
|
try:
|
||||||
imported_module = __import__(module, fromlist=["PIL"])
|
imported_module = __import__(module, fromlist=["PIL"])
|
||||||
if isinstance(flag, bool):
|
if isinstance(flag, bool):
|
||||||
deprecate(f'check_feature("{feature}")', 12)
|
|
||||||
return flag
|
return flag
|
||||||
return getattr(imported_module, flag)
|
return getattr(imported_module, flag)
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user