Skip to content

Commit 532653d

Browse files
committed
Moved code outside of context manager
1 parent fc357ed commit 532653d

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Tests/test_file_jpeg2k.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,12 @@ def test_grayscale_four_channels() -> None:
317317
with open("Tests/images/rgb_trns_ycbc.jp2", "rb") as fp:
318318
data = fp.read()
319319

320-
# Change color space to OPJ_CLRSPC_GRAY
321-
data = data[:76] + b"\x11" + data[77:]
320+
# Change color space to OPJ_CLRSPC_GRAY
321+
data = data[:76] + b"\x11" + data[77:]
322322

323-
with Image.open(BytesIO(data)) as im:
324-
im.load()
325-
assert im.mode == "RGBA"
323+
with Image.open(BytesIO(data)) as im:
324+
im.load()
325+
assert im.mode == "RGBA"
326326

327327

328328
@pytest.mark.skipif(

Tests/test_file_pcx.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_sanity(tmp_path: Path) -> None:
4040
def test_bad_image_size() -> None:
4141
with open("Tests/images/pil184.pcx", "rb") as fp:
4242
data = fp.read()
43-
data = data[:4] + b"\xff\xff" + data[6:]
43+
data = data[:4] + b"\xff\xff" + data[6:]
4444

4545
b = io.BytesIO(data)
4646
with pytest.raises(SyntaxError, match="bad PCX image size"):
@@ -51,7 +51,7 @@ def test_bad_image_size() -> None:
5151
def test_unknown_mode() -> None:
5252
with open("Tests/images/pil184.pcx", "rb") as fp:
5353
data = fp.read()
54-
data = data[:3] + b"\xff" + data[4:]
54+
data = data[:3] + b"\xff" + data[4:]
5555

5656
b = io.BytesIO(data)
5757
with pytest.raises(OSError, match="unknown PCX mode"):

Tests/test_font_bdf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def test_sanity() -> None:
2020
def test_zero_width_chars() -> None:
2121
with open(filename, "rb") as fp:
2222
data = fp.read()
23-
data = data[:2650] + b"\x00\x00" + data[2652:]
24-
BdfFontFile.BdfFontFile(io.BytesIO(data))
23+
data = data[:2650] + b"\x00\x00" + data[2652:]
24+
BdfFontFile.BdfFontFile(io.BytesIO(data))
2525

2626

2727
def test_invalid_file() -> None:

0 commit comments

Comments
 (0)