Skip to content

Commit d62b909

Browse files
committed
Refactor other tests into test_pickle_image
1 parent 53a85f2 commit d62b909

1 file changed

Lines changed: 15 additions & 32 deletions

File tree

Tests/test_pickle.py

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -39,45 +39,28 @@ def helper_pickle_string(
3939

4040

4141
@pytest.mark.parametrize(
42-
"test_file", ["Tests/images/hopper.jpg"],
42+
("test_file", "test_mode"),
43+
[
44+
("Tests/images/hopper.jpg", None),
45+
("Tests/images/hopper.jpg", "L"),
46+
("Tests/images/hopper.jpg", "PA"),
47+
("Tests/images/test-card.png", None),
48+
("Tests/images/zero_bb.png", None),
49+
("Tests/images/zero_bb_scale2.png", None),
50+
("Tests/images/non_zero_bb.png", None),
51+
("Tests/images/non_zero_bb_scale2.png", None),
52+
("Tests/images/p_trns_single.png", None),
53+
("Tests/images/pil123p.png", None),
54+
("Tests/images/itxt_chunks.png", None),
55+
],
4356
)
44-
def test_pickle_image(test_file, tmp_path):
57+
def test_pickle_image(tmp_path, test_file, test_mode):
4558
# Act / Assert
4659
for protocol in range(0, pickle.HIGHEST_PROTOCOL + 1):
4760
helper_pickle_string(pickle, protocol, test_file)
4861
helper_pickle_file(tmp_path, pickle, protocol, test_file)
4962

5063

51-
def test_pickle_p_mode():
52-
# Act / Assert
53-
for test_file in [
54-
"Tests/images/test-card.png",
55-
"Tests/images/zero_bb.png",
56-
"Tests/images/zero_bb_scale2.png",
57-
"Tests/images/non_zero_bb.png",
58-
"Tests/images/non_zero_bb_scale2.png",
59-
"Tests/images/p_trns_single.png",
60-
"Tests/images/pil123p.png",
61-
"Tests/images/itxt_chunks.png",
62-
]:
63-
for protocol in range(0, pickle.HIGHEST_PROTOCOL + 1):
64-
helper_pickle_string(pickle, protocol=protocol, test_file=test_file)
65-
66-
67-
def test_pickle_pa_mode(tmp_path):
68-
# Act / Assert
69-
for protocol in range(0, pickle.HIGHEST_PROTOCOL + 1):
70-
helper_pickle_string(pickle, protocol, mode="PA")
71-
helper_pickle_file(tmp_path, pickle, protocol, mode="PA")
72-
73-
74-
def test_pickle_l_mode(tmp_path):
75-
# Act / Assert
76-
for protocol in range(0, pickle.HIGHEST_PROTOCOL + 1):
77-
helper_pickle_string(pickle, protocol, mode="L")
78-
helper_pickle_file(tmp_path, pickle, protocol, mode="L")
79-
80-
8164
def test_pickle_la_mode_with_palette(tmp_path):
8265
# Arrange
8366
filename = str(tmp_path / "temp.pkl")

0 commit comments

Comments
 (0)