Skip to content

Commit 412f5a5

Browse files
committed
Moved test_wrong_bits_per_sample to test_file_libtiff.py
1 parent 510de50 commit 412f5a5

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

Tests/test_file_libtiff.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,36 @@ def test_open_missing_samplesperpixel(self):
986986
) as im:
987987
assert_image_equal_tofile(im, "Tests/images/old-style-jpeg-compression.png")
988988

989+
@pytest.mark.parametrize(
990+
"file_name,mode,size,tile",
991+
[
992+
(
993+
"tiff_wrong_bits_per_sample.tiff",
994+
"RGBA",
995+
(52, 53),
996+
[("raw", (0, 0, 52, 53), 160, ("RGBA", 0, 1))],
997+
),
998+
(
999+
"tiff_wrong_bits_per_sample_2.tiff",
1000+
"RGB",
1001+
(16, 16),
1002+
[("raw", (0, 0, 16, 16), 8, ("RGB", 0, 1))],
1003+
),
1004+
(
1005+
"tiff_wrong_bits_per_sample_3.tiff",
1006+
"RGBA",
1007+
(512, 256),
1008+
[("libtiff", (0, 0, 512, 256), 0, ("RGBA", "tiff_lzw", False, 48782))],
1009+
),
1010+
],
1011+
)
1012+
def test_wrong_bits_per_sample(self, file_name, mode, size, tile):
1013+
with Image.open("Tests/images/" + file_name) as im:
1014+
assert im.mode == mode
1015+
assert im.size == size
1016+
assert im.tile == tile
1017+
im.load()
1018+
9891019
def test_no_rows_per_strip(self):
9901020
# This image does not have a RowsPerStrip TIFF tag
9911021
infile = "Tests/images/no_rows_per_strip.tif"

Tests/test_file_tiff.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -100,36 +100,6 @@ def test_bigtiff(self):
100100
with Image.open("Tests/images/hopper_bigtiff.tif") as im:
101101
assert_image_equal_tofile(im, "Tests/images/hopper.tif")
102102

103-
@pytest.mark.parametrize(
104-
"file_name,mode,size,tile",
105-
[
106-
(
107-
"tiff_wrong_bits_per_sample.tiff",
108-
"RGBA",
109-
(52, 53),
110-
[("raw", (0, 0, 52, 53), 160, ("RGBA", 0, 1))],
111-
),
112-
(
113-
"tiff_wrong_bits_per_sample_2.tiff",
114-
"RGB",
115-
(16, 16),
116-
[("raw", (0, 0, 16, 16), 8, ("RGB", 0, 1))],
117-
),
118-
(
119-
"tiff_wrong_bits_per_sample_3.tiff",
120-
"RGBA",
121-
(512, 256),
122-
[("libtiff", (0, 0, 512, 256), 0, ("RGBA", "tiff_lzw", False, 48782))],
123-
),
124-
],
125-
)
126-
def test_wrong_bits_per_sample(self, file_name, mode, size, tile):
127-
with Image.open("Tests/images/" + file_name) as im:
128-
assert im.mode == mode
129-
assert im.size == size
130-
assert im.tile == tile
131-
im.load()
132-
133103
def test_set_legacy_api(self):
134104
ifd = TiffImagePlugin.ImageFileDirectory_v2()
135105
with pytest.raises(Exception) as e:

0 commit comments

Comments
 (0)