Skip to content

Commit f8566b9

Browse files
authored
Merge pull request #8755 from hugovk/rm-_wedge
Remove debug `Image._wedge`
2 parents 397e6f2 + 126026e commit f8566b9

File tree

4 files changed

+16
-31
lines changed

4 files changed

+16
-31
lines changed

Tests/test_file_gif.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
# sample gif stream
2323
TEST_GIF = "Tests/images/hopper.gif"
2424

25-
with open(TEST_GIF, "rb") as f:
26-
data = f.read()
27-
2825

2926
def test_sanity() -> None:
3027
with Image.open(TEST_GIF) as im:
@@ -37,12 +34,12 @@ def test_sanity() -> None:
3734

3835
@pytest.mark.skipif(is_pypy(), reason="Requires CPython")
3936
def test_unclosed_file() -> None:
40-
def open() -> None:
37+
def open_test_image() -> None:
4138
im = Image.open(TEST_GIF)
4239
im.load()
4340

4441
with pytest.warns(ResourceWarning):
45-
open()
42+
open_test_image()
4643

4744

4845
def test_closed_file() -> None:
@@ -1348,7 +1345,7 @@ def test_save_I(tmp_path: Path) -> None:
13481345
def test_getdata(monkeypatch: pytest.MonkeyPatch) -> None:
13491346
# Test getheader/getdata against legacy values.
13501347
# Create a 'P' image with holes in the palette.
1351-
im = Image._wedge().resize((16, 16), Image.Resampling.NEAREST)
1348+
im = Image.linear_gradient(mode="L").resize((16, 16), Image.Resampling.NEAREST)
13521349
im.putpalette(ImagePalette.ImagePalette("RGB"))
13531350
im.info = {"background": 0}
13541351

Tests/test_format_hsv.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,26 @@ def test_sanity() -> None:
2222
Image.new("HSV", (100, 100))
2323

2424

25-
def wedge() -> Image.Image:
26-
w = Image._wedge()
27-
w90 = w.rotate(90)
25+
def linear_gradient() -> Image.Image:
26+
im = Image.linear_gradient(mode="L")
27+
im90 = im.rotate(90)
2828

29-
(px, h) = w.size
29+
(px, h) = im.size
3030

3131
r = Image.new("L", (px * 3, h))
3232
g = r.copy()
3333
b = r.copy()
3434

35-
r.paste(w, (0, 0))
36-
r.paste(w90, (px, 0))
35+
r.paste(im, (0, 0))
36+
r.paste(im90, (px, 0))
3737

38-
g.paste(w90, (0, 0))
39-
g.paste(w, (2 * px, 0))
38+
g.paste(im90, (0, 0))
39+
g.paste(im, (2 * px, 0))
4040

41-
b.paste(w, (px, 0))
42-
b.paste(w90, (2 * px, 0))
41+
b.paste(im, (px, 0))
42+
b.paste(im90, (2 * px, 0))
4343

44-
img = Image.merge("RGB", (r, g, b))
45-
46-
return img
44+
return Image.merge("RGB", (r, g, b))
4745

4846

4947
def to_xxx_colorsys(
@@ -79,8 +77,8 @@ def to_rgb_colorsys(im: Image.Image) -> Image.Image:
7977
return to_xxx_colorsys(im, colorsys.hsv_to_rgb, "RGB")
8078

8179

82-
def test_wedge() -> None:
83-
src = wedge().resize((3 * 32, 32), Image.Resampling.BILINEAR)
80+
def test_linear_gradient() -> None:
81+
src = linear_gradient().resize((3 * 32, 32), Image.Resampling.BILINEAR)
8482
im = src.convert("HSV")
8583
comparable = to_hsv_colorsys(src)
8684

src/PIL/Image.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2996,15 +2996,6 @@ def transform(
29962996
# --------------------------------------------------------------------
29972997
# Factories
29982998

2999-
#
3000-
# Debugging
3001-
3002-
3003-
def _wedge() -> Image:
3004-
"""Create grayscale wedge (for debugging only)"""
3005-
3006-
return Image()._new(core.wedge("L"))
3007-
30082999

30093000
def _check_size(size: Any) -> None:
30103001
"""

src/_imaging.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4256,7 +4256,6 @@ static PyMethodDef functions[] = {
42564256
{"effect_noise", (PyCFunction)_effect_noise, METH_VARARGS},
42574257
{"linear_gradient", (PyCFunction)_linear_gradient, METH_VARARGS},
42584258
{"radial_gradient", (PyCFunction)_radial_gradient, METH_VARARGS},
4259-
{"wedge", (PyCFunction)_linear_gradient, METH_VARARGS}, /* Compatibility */
42604259

42614260
/* Drawing support stuff */
42624261
{"font", (PyCFunction)_font_new, METH_VARARGS},

0 commit comments

Comments
 (0)