mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 17:06:16 +03:00
Clarify JPEG tests for default/invalid subsampling
-1 is the default; 3 is invalid and should behave the same as the default.
This commit is contained in:
parent
f90827dfc8
commit
14146732be
|
@ -434,8 +434,9 @@ class TestFileJpeg:
|
||||||
return layer[0][1:3] + layer[1][1:3] + layer[2][1:3]
|
return layer[0][1:3] + layer[1][1:3] + layer[2][1:3]
|
||||||
|
|
||||||
# experimental API
|
# experimental API
|
||||||
im = self.roundtrip(hopper(), subsampling=-1) # default
|
for subsampling in (-1, 3): # (default, invalid)
|
||||||
assert getsampling(im) == (2, 2, 1, 1, 1, 1)
|
im = self.roundtrip(hopper(), subsampling=subsampling)
|
||||||
|
assert getsampling(im) == (2, 2, 1, 1, 1, 1)
|
||||||
for subsampling in (0, "4:4:4"):
|
for subsampling in (0, "4:4:4"):
|
||||||
im = self.roundtrip(hopper(), subsampling=subsampling)
|
im = self.roundtrip(hopper(), subsampling=subsampling)
|
||||||
assert getsampling(im) == (1, 1, 1, 1, 1, 1)
|
assert getsampling(im) == (1, 1, 1, 1, 1, 1)
|
||||||
|
@ -446,11 +447,8 @@ class TestFileJpeg:
|
||||||
im = self.roundtrip(hopper(), subsampling=subsampling)
|
im = self.roundtrip(hopper(), subsampling=subsampling)
|
||||||
assert getsampling(im) == (2, 2, 1, 1, 1, 1)
|
assert getsampling(im) == (2, 2, 1, 1, 1, 1)
|
||||||
|
|
||||||
im = self.roundtrip(hopper(), subsampling=3) # default (undefined)
|
|
||||||
assert getsampling(im) == (2, 2, 1, 1, 1, 1)
|
|
||||||
|
|
||||||
# RGB colorspace, no subsampling by default
|
# RGB colorspace, no subsampling by default
|
||||||
im = self.roundtrip(hopper(), subsampling=3, keep_rgb=True)
|
im = self.roundtrip(hopper(), keep_rgb=True)
|
||||||
assert getsampling(im) == (1, 1, 1, 1, 1, 1)
|
assert getsampling(im) == (1, 1, 1, 1, 1, 1)
|
||||||
|
|
||||||
with pytest.raises(TypeError):
|
with pytest.raises(TypeError):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user