From 3a45e5662db9325d4cf4ecd68f61bcfaa1da336b Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 1 Jul 2024 20:21:21 +1000 Subject: [PATCH] Updated deprecation timeline --- Tests/test_deprecate.py | 20 ++++++++++---------- src/PIL/_deprecate.py | 2 -- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Tests/test_deprecate.py b/Tests/test_deprecate.py index 584d8f91d..82ff14181 100644 --- a/Tests/test_deprecate.py +++ b/Tests/test_deprecate.py @@ -9,9 +9,9 @@ from PIL import _deprecate "version, expected", [ ( - 11, - "Old thing is deprecated and will be removed in Pillow 11 " - r"\(2024-10-15\)\. Use new thing instead\.", + 12, + "Old thing is deprecated and will be removed in Pillow 12 " + r"\(2025-10-15\)\. Use new thing instead\.", ), ( None, @@ -54,18 +54,18 @@ def test_old_version(deprecated: str, plural: bool, expected: str) -> None: def test_plural() -> None: expected = ( - r"Old things are deprecated and will be removed in Pillow 11 \(2024-10-15\)\. " + r"Old things are deprecated and will be removed in Pillow 12 \(2025-10-15\)\. " r"Use new thing instead\." ) with pytest.warns(DeprecationWarning, match=expected): - _deprecate.deprecate("Old things", 11, "new thing", plural=True) + _deprecate.deprecate("Old things", 12, "new thing", plural=True) def test_replacement_and_action() -> None: expected = "Use only one of 'replacement' and 'action'" with pytest.raises(ValueError, match=expected): _deprecate.deprecate( - "Old thing", 11, replacement="new thing", action="Upgrade to new thing" + "Old thing", 12, replacement="new thing", action="Upgrade to new thing" ) @@ -78,16 +78,16 @@ def test_replacement_and_action() -> None: ) def test_action(action: str) -> None: expected = ( - r"Old thing is deprecated and will be removed in Pillow 11 \(2024-10-15\)\. " + r"Old thing is deprecated and will be removed in Pillow 12 \(2025-10-15\)\. " r"Upgrade to new thing\." ) with pytest.warns(DeprecationWarning, match=expected): - _deprecate.deprecate("Old thing", 11, action=action) + _deprecate.deprecate("Old thing", 12, action=action) def test_no_replacement_or_action() -> None: expected = ( - r"Old thing is deprecated and will be removed in Pillow 11 \(2024-10-15\)" + r"Old thing is deprecated and will be removed in Pillow 12 \(2025-10-15\)" ) with pytest.warns(DeprecationWarning, match=expected): - _deprecate.deprecate("Old thing", 11) + _deprecate.deprecate("Old thing", 12) diff --git a/src/PIL/_deprecate.py b/src/PIL/_deprecate.py index 33a0e07b3..83952b397 100644 --- a/src/PIL/_deprecate.py +++ b/src/PIL/_deprecate.py @@ -45,8 +45,6 @@ def deprecate( elif when <= int(__version__.split(".")[0]): msg = f"{deprecated} {is_} deprecated and should be removed." raise RuntimeError(msg) - elif when == 11: - removed = "Pillow 11 (2024-10-15)" elif when == 12: removed = "Pillow 12 (2025-10-15)" else: