Skip to content

Commit

Permalink
Removed deprecated features from get_supported_features()
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Aug 13, 2024
1 parent cdec9cf commit a1e2eea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 10 additions & 2 deletions Tests/test_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ def test_check() -> None:
for codec in features.codecs:
assert features.check_codec(codec) == features.check(codec)
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:
Expand All @@ -43,7 +47,11 @@ def test(name: str, function: Callable[[str], str | None]) -> None:
for codec in features.codecs:
test(codec, features.version_codec)
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:
Expand Down
6 changes: 5 additions & 1 deletion src/PIL/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ def get_supported_features() -> list[str]:
"""
:returns: A list of all supported features.
"""
return [f for f in features if check_feature(f)]
supported_features = []
for f, (_, flag, _) in features.items():
if flag is not True and check_feature(f):
supported_features.append(f)
return supported_features


def check(feature: str) -> bool | None:
Expand Down

0 comments on commit a1e2eea

Please sign in to comment.