Skip to content

Commit dcd52eb

Browse files
committed
Simplified code
1 parent d6e0a8d commit dcd52eb

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

Tests/test_file_psd.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def test_seek_tell() -> None:
100100

101101
im.seek(2)
102102
layer_number = im.tell()
103-
assert layer_number == 2
103+
assert layer_number == 2
104104

105105

106106
def test_seek_eoferror() -> None:
@@ -138,7 +138,7 @@ def test_icc_profile() -> None:
138138
assert "icc_profile" in im.info
139139

140140
icc_profile = im.info["icc_profile"]
141-
assert len(icc_profile) == 3144
141+
assert len(icc_profile) == 3144
142142

143143

144144
def test_no_icc_profile() -> None:
@@ -158,17 +158,16 @@ def test_combined_larger_than_size() -> None:
158158

159159

160160
@pytest.mark.parametrize(
161-
"test_file,raises",
161+
"test_file",
162162
[
163-
("Tests/images/timeout-c8efc3fded6426986ba867a399791bae544f59bc.psd", OSError),
164-
("Tests/images/timeout-dedc7a4ebd856d79b4359bbcc79e8ef231ce38f6.psd", OSError),
163+
"Tests/images/timeout-c8efc3fded6426986ba867a399791bae544f59bc.psd",
164+
"Tests/images/timeout-dedc7a4ebd856d79b4359bbcc79e8ef231ce38f6.psd",
165165
],
166166
)
167-
def test_crashes(test_file: str, raises: type[Exception]) -> None:
168-
with open(test_file, "rb") as f:
169-
with pytest.raises(raises):
170-
with Image.open(f):
171-
pass
167+
def test_crashes(test_file: str) -> None:
168+
with pytest.raises(OSError):
169+
with Image.open(test_file):
170+
pass
172171

173172

174173
@pytest.mark.parametrize(
@@ -179,8 +178,7 @@ def test_crashes(test_file: str, raises: type[Exception]) -> None:
179178
],
180179
)
181180
def test_layer_crashes(test_file: str) -> None:
182-
with open(test_file, "rb") as f:
183-
with Image.open(f) as im:
184-
assert isinstance(im, PsdImagePlugin.PsdImageFile)
185-
with pytest.raises(SyntaxError):
186-
im.layers
181+
with Image.open(test_file) as im:
182+
assert isinstance(im, PsdImagePlugin.PsdImageFile)
183+
with pytest.raises(SyntaxError):
184+
im.layers

0 commit comments

Comments
 (0)