mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 02:06:18 +03:00
Test deprecation warnings
This commit is contained in:
parent
45552b5b4f
commit
359d7592c7
|
@ -18,7 +18,11 @@ def test_check() -> None:
|
||||||
for codec in features.codecs:
|
for codec in features.codecs:
|
||||||
assert features.check_codec(codec) == features.check(codec)
|
assert features.check_codec(codec) == features.check(codec)
|
||||||
for feature in features.features:
|
for feature in features.features:
|
||||||
assert features.check_feature(feature) == features.check(feature)
|
if "webp" in feature:
|
||||||
|
with pytest.warns(DeprecationWarning):
|
||||||
|
assert features.check_feature(feature) == features.check(feature)
|
||||||
|
else:
|
||||||
|
assert features.check_feature(feature) == features.check(feature)
|
||||||
|
|
||||||
|
|
||||||
def test_version() -> None:
|
def test_version() -> None:
|
||||||
|
@ -43,19 +47,26 @@ def test_version() -> None:
|
||||||
for codec in features.codecs:
|
for codec in features.codecs:
|
||||||
test(codec, features.version_codec)
|
test(codec, features.version_codec)
|
||||||
for feature in features.features:
|
for feature in features.features:
|
||||||
test(feature, features.version_feature)
|
if "webp" in feature:
|
||||||
|
with pytest.warns(DeprecationWarning):
|
||||||
|
test(feature, features.version_feature)
|
||||||
|
else:
|
||||||
|
test(feature, features.version_feature)
|
||||||
|
|
||||||
|
|
||||||
def test_webp_transparency() -> None:
|
def test_webp_transparency() -> None:
|
||||||
assert features.check("transp_webp") == features.check_module("webp")
|
with pytest.warns(DeprecationWarning):
|
||||||
|
assert features.check("transp_webp") == features.check_module("webp")
|
||||||
|
|
||||||
|
|
||||||
def test_webp_mux() -> None:
|
def test_webp_mux() -> None:
|
||||||
assert features.check("webp_mux") == features.check_module("webp")
|
with pytest.warns(DeprecationWarning):
|
||||||
|
assert features.check("webp_mux") == features.check_module("webp")
|
||||||
|
|
||||||
|
|
||||||
def test_webp_anim() -> None:
|
def test_webp_anim() -> None:
|
||||||
assert features.check("webp_anim") == features.check_module("webp")
|
with pytest.warns(DeprecationWarning):
|
||||||
|
assert features.check("webp_anim") == features.check_module("webp")
|
||||||
|
|
||||||
|
|
||||||
@skip_unless_feature("libjpeg_turbo")
|
@skip_unless_feature("libjpeg_turbo")
|
||||||
|
|
|
@ -180,7 +180,17 @@ def get_supported_features() -> list[str]:
|
||||||
"""
|
"""
|
||||||
:returns: A list of all supported features.
|
:returns: A list of all supported features.
|
||||||
"""
|
"""
|
||||||
return [f for f in features if check_feature(f)]
|
supported_features = []
|
||||||
|
for f, (module, flag, _) in features.items():
|
||||||
|
if flag is True:
|
||||||
|
for feature, (feature_module, _) in modules.items():
|
||||||
|
if feature_module == module:
|
||||||
|
if check_module(feature):
|
||||||
|
supported_features.append(f)
|
||||||
|
break
|
||||||
|
elif check_feature(f):
|
||||||
|
supported_features.append(f)
|
||||||
|
return supported_features
|
||||||
|
|
||||||
|
|
||||||
def check(feature: str) -> bool | None:
|
def check(feature: str) -> bool | None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user