mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-14 01:04:45 +03:00
rename variable "resample" to "resampling_filter"
This commit is contained in:
parent
738afe3b85
commit
0a827f0c77
|
@ -47,7 +47,7 @@ class TestImagingCoreResize:
|
||||||
assert r.im.bands == im.im.bands
|
assert r.im.bands == im.im.bands
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"resample",
|
"resampling_filter",
|
||||||
(
|
(
|
||||||
Image.Resampling.NEAREST,
|
Image.Resampling.NEAREST,
|
||||||
Image.Resampling.BOX,
|
Image.Resampling.BOX,
|
||||||
|
@ -57,13 +57,13 @@ class TestImagingCoreResize:
|
||||||
Image.Resampling.LANCZOS,
|
Image.Resampling.LANCZOS,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_reduce_filters(self, resample):
|
def test_reduce_filters(self, resampling_filter):
|
||||||
r = self.resize(hopper("RGB"), (15, 12), resample)
|
r = self.resize(hopper("RGB"), (15, 12), resampling_filter)
|
||||||
assert r.mode == "RGB"
|
assert r.mode == "RGB"
|
||||||
assert r.size == (15, 12)
|
assert r.size == (15, 12)
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"resample",
|
"resampling_filter",
|
||||||
(
|
(
|
||||||
Image.Resampling.NEAREST,
|
Image.Resampling.NEAREST,
|
||||||
Image.Resampling.BOX,
|
Image.Resampling.BOX,
|
||||||
|
@ -73,13 +73,13 @@ class TestImagingCoreResize:
|
||||||
Image.Resampling.LANCZOS,
|
Image.Resampling.LANCZOS,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_enlarge_filters(self, resample):
|
def test_enlarge_filters(self, resampling_filter):
|
||||||
r = self.resize(hopper("RGB"), (212, 195), resample)
|
r = self.resize(hopper("RGB"), (212, 195), resampling_filter)
|
||||||
assert r.mode == "RGB"
|
assert r.mode == "RGB"
|
||||||
assert r.size == (212, 195)
|
assert r.size == (212, 195)
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"resample",
|
"resampling_filter",
|
||||||
(
|
(
|
||||||
Image.Resampling.NEAREST,
|
Image.Resampling.NEAREST,
|
||||||
Image.Resampling.BOX,
|
Image.Resampling.BOX,
|
||||||
|
@ -97,7 +97,7 @@ class TestImagingCoreResize:
|
||||||
("LA", ("filled", "dirty")),
|
("LA", ("filled", "dirty")),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_endianness(self, resample, mode, channels_set):
|
def test_endianness(self, resampling_filter, mode, channels_set):
|
||||||
# Make an image with one colored pixel, in one channel.
|
# Make an image with one colored pixel, in one channel.
|
||||||
# When resized, that channel should be the same as a GS image.
|
# When resized, that channel should be the same as a GS image.
|
||||||
# Other channels should be unaffected.
|
# Other channels should be unaffected.
|
||||||
|
@ -113,13 +113,14 @@ class TestImagingCoreResize:
|
||||||
|
|
||||||
# samples resized with current filter
|
# samples resized with current filter
|
||||||
references = {
|
references = {
|
||||||
name: self.resize(ch, (4, 4), resample) for name, ch in samples.items()
|
name: self.resize(ch, (4, 4), resampling_filter)
|
||||||
|
for name, ch in samples.items()
|
||||||
}
|
}
|
||||||
|
|
||||||
for channels in set(permutations(channels_set)):
|
for channels in set(permutations(channels_set)):
|
||||||
# compile image from different channels permutations
|
# compile image from different channels permutations
|
||||||
im = Image.merge(mode, [samples[ch] for ch in channels])
|
im = Image.merge(mode, [samples[ch] for ch in channels])
|
||||||
resized = self.resize(im, (4, 4), resample)
|
resized = self.resize(im, (4, 4), resampling_filter)
|
||||||
|
|
||||||
for i, ch in enumerate(resized.split()):
|
for i, ch in enumerate(resized.split()):
|
||||||
# check what resized channel in image is the same
|
# check what resized channel in image is the same
|
||||||
|
@ -127,7 +128,7 @@ class TestImagingCoreResize:
|
||||||
assert_image_equal(ch, references[channels[i]])
|
assert_image_equal(ch, references[channels[i]])
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"resample",
|
"resampling_filter",
|
||||||
(
|
(
|
||||||
Image.Resampling.NEAREST,
|
Image.Resampling.NEAREST,
|
||||||
Image.Resampling.BOX,
|
Image.Resampling.BOX,
|
||||||
|
@ -137,8 +138,10 @@ class TestImagingCoreResize:
|
||||||
Image.Resampling.LANCZOS,
|
Image.Resampling.LANCZOS,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_enlarge_zero(self, resample):
|
def test_enlarge_zero(self, resampling_filter):
|
||||||
r = self.resize(Image.new("RGB", (0, 0), "white"), (212, 195), resample)
|
r = self.resize(
|
||||||
|
Image.new("RGB", (0, 0), "white"), (212, 195), resampling_filter
|
||||||
|
)
|
||||||
assert r.mode == "RGB"
|
assert r.mode == "RGB"
|
||||||
assert r.size == (212, 195)
|
assert r.size == (212, 195)
|
||||||
assert r.getdata()[0] == (0, 0, 0)
|
assert r.getdata()[0] == (0, 0, 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user