Skip to content

Commit

Permalink
Simplified variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere authored and Yay295 committed Apr 7, 2024
1 parent 467f082 commit 02911c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
uploader = "github_actions"


image_mode_names = (
modes = (
"1",
"L",
"LA",
Expand Down
10 changes: 5 additions & 5 deletions Tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
assert_image_similar_tofile,
assert_not_all_same,
hopper,
image_mode_names,
is_win32,
mark_if_feature_version,
modes,
skip_unless_feature,
)


class TestImage:
@pytest.mark.parametrize("mode", image_mode_names)
@pytest.mark.parametrize("mode", modes)
def test_image_modes_success(self, mode: str) -> None:
Image.new(mode, (1, 1))

Expand Down Expand Up @@ -1017,15 +1017,15 @@ def test_close_graceful(self, caplog: pytest.LogCaptureFixture) -> None:


class TestImageBytes:
@pytest.mark.parametrize("mode", image_mode_names)
@pytest.mark.parametrize("mode", modes)
def test_roundtrip_bytes_constructor(self, mode: str) -> None:
im = hopper(mode)
source_bytes = im.tobytes()

reloaded = Image.frombytes(mode, im.size, source_bytes)
assert reloaded.tobytes() == source_bytes

@pytest.mark.parametrize("mode", image_mode_names)
@pytest.mark.parametrize("mode", modes)
def test_roundtrip_bytes_method(self, mode: str) -> None:
im = hopper(mode)
source_bytes = im.tobytes()
Expand All @@ -1034,7 +1034,7 @@ def test_roundtrip_bytes_method(self, mode: str) -> None:
reloaded.frombytes(source_bytes)
assert reloaded.tobytes() == source_bytes

@pytest.mark.parametrize("mode", image_mode_names)
@pytest.mark.parametrize("mode", modes)
def test_getdata_putdata(self, mode: str) -> None:
im = hopper(mode)

Expand Down
4 changes: 2 additions & 2 deletions Tests/test_image_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from PIL import Image

from .helper import assert_image_equal, hopper, image_mode_names, is_win32
from .helper import assert_image_equal, hopper, is_win32, modes

# CFFI imports pycparser which doesn't support PYTHONOPTIMIZE=2
# https://github.com/eliben/pycparser/pull/198#issuecomment-317001670
Expand Down Expand Up @@ -205,7 +205,7 @@ def check(self, mode: str, expected_color_int: int | None = None) -> None:
with pytest.raises(error):
im.getpixel((-1, -1))

@pytest.mark.parametrize("mode", image_mode_names)
@pytest.mark.parametrize("mode", modes)
def test_basic(self, mode: str) -> None:
self.check(mode)

Expand Down

0 comments on commit 02911c7

Please sign in to comment.