Skip to content

Commit

Permalink
Remove debug Image._wedge
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Feb 15, 2025
1 parent c4eb2fe commit ed1872b
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 64 deletions.
2 changes: 1 addition & 1 deletion Tests/test_file_gif.py
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ def test_save_I(tmp_path: Path) -> None:
def test_getdata(monkeypatch: pytest.MonkeyPatch) -> None:
# Test getheader/getdata against legacy values.
# Create a 'P' image with holes in the palette.
im = Image._wedge().resize((16, 16), Image.Resampling.NEAREST)
im = Image.linear_gradient(mode="L").resize((16, 16), Image.Resampling.NEAREST)
im.putpalette(ImagePalette.ImagePalette("RGB"))
im.info = {"background": 0}

Expand Down
56 changes: 0 additions & 56 deletions Tests/test_format_hsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,6 @@ def test_sanity() -> None:
Image.new("HSV", (100, 100))


def wedge() -> Image.Image:
w = Image._wedge()
w90 = w.rotate(90)

(px, h) = w.size

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

r.paste(w, (0, 0))
r.paste(w90, (px, 0))

g.paste(w90, (0, 0))
g.paste(w, (2 * px, 0))

b.paste(w, (px, 0))
b.paste(w90, (2 * px, 0))

img = Image.merge("RGB", (r, g, b))

return img


def to_xxx_colorsys(
im: Image.Image,
func: Callable[[float, float, float], tuple[float, float, float]],
Expand Down Expand Up @@ -79,38 +55,6 @@ def to_rgb_colorsys(im: Image.Image) -> Image.Image:
return to_xxx_colorsys(im, colorsys.hsv_to_rgb, "RGB")


def test_wedge() -> None:
src = wedge().resize((3 * 32, 32), Image.Resampling.BILINEAR)
im = src.convert("HSV")
comparable = to_hsv_colorsys(src)

assert_image_similar(
im.getchannel(0), comparable.getchannel(0), 1, "Hue conversion is wrong"
)
assert_image_similar(
im.getchannel(1),
comparable.getchannel(1),
1,
"Saturation conversion is wrong",
)
assert_image_similar(
im.getchannel(2), comparable.getchannel(2), 1, "Value conversion is wrong"
)

comparable = src
im = im.convert("RGB")

assert_image_similar(
im.getchannel(0), comparable.getchannel(0), 3, "R conversion is wrong"
)
assert_image_similar(
im.getchannel(1), comparable.getchannel(1), 3, "G conversion is wrong"
)
assert_image_similar(
im.getchannel(2), comparable.getchannel(2), 3, "B conversion is wrong"
)


def test_convert() -> None:
im = hopper("RGB").convert("HSV")
comparable = to_hsv_colorsys(hopper("RGB"))
Expand Down
6 changes: 0 additions & 6 deletions src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -3000,12 +3000,6 @@ def transform(
# Debugging


def _wedge() -> Image:
"""Create grayscale wedge (for debugging only)"""

return Image()._new(core.wedge("L"))


def _check_size(size: Any) -> None:
"""
Common check to enforce type and sanity check on size tuples
Expand Down
1 change: 0 additions & 1 deletion src/_imaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -4256,7 +4256,6 @@ static PyMethodDef functions[] = {
{"effect_noise", (PyCFunction)_effect_noise, METH_VARARGS},
{"linear_gradient", (PyCFunction)_linear_gradient, METH_VARARGS},
{"radial_gradient", (PyCFunction)_radial_gradient, METH_VARARGS},
{"wedge", (PyCFunction)_linear_gradient, METH_VARARGS}, /* Compatibility */

/* Drawing support stuff */
{"font", (PyCFunction)_font_new, METH_VARARGS},
Expand Down

0 comments on commit ed1872b

Please sign in to comment.