mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-04-13 05:44:16 +03:00
Moved code outside of context manager
This commit is contained in:
parent
5575c1d072
commit
baa299a6f4
|
@ -317,12 +317,12 @@ def test_grayscale_four_channels() -> None:
|
|||
with open("Tests/images/rgb_trns_ycbc.jp2", "rb") as fp:
|
||||
data = fp.read()
|
||||
|
||||
# Change color space to OPJ_CLRSPC_GRAY
|
||||
data = data[:76] + b"\x11" + data[77:]
|
||||
# Change color space to OPJ_CLRSPC_GRAY
|
||||
data = data[:76] + b"\x11" + data[77:]
|
||||
|
||||
with Image.open(BytesIO(data)) as im:
|
||||
im.load()
|
||||
assert im.mode == "RGBA"
|
||||
with Image.open(BytesIO(data)) as im:
|
||||
im.load()
|
||||
assert im.mode == "RGBA"
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
|
|
|
@ -40,7 +40,7 @@ def test_sanity(tmp_path: Path) -> None:
|
|||
def test_bad_image_size() -> None:
|
||||
with open("Tests/images/pil184.pcx", "rb") as fp:
|
||||
data = fp.read()
|
||||
data = data[:4] + b"\xff\xff" + data[6:]
|
||||
data = data[:4] + b"\xff\xff" + data[6:]
|
||||
|
||||
b = io.BytesIO(data)
|
||||
with pytest.raises(SyntaxError, match="bad PCX image size"):
|
||||
|
@ -51,7 +51,7 @@ def test_bad_image_size() -> None:
|
|||
def test_unknown_mode() -> None:
|
||||
with open("Tests/images/pil184.pcx", "rb") as fp:
|
||||
data = fp.read()
|
||||
data = data[:3] + b"\xff" + data[4:]
|
||||
data = data[:3] + b"\xff" + data[4:]
|
||||
|
||||
b = io.BytesIO(data)
|
||||
with pytest.raises(OSError, match="unknown PCX mode"):
|
||||
|
|
|
@ -20,8 +20,8 @@ def test_sanity() -> None:
|
|||
def test_zero_width_chars() -> None:
|
||||
with open(filename, "rb") as fp:
|
||||
data = fp.read()
|
||||
data = data[:2650] + b"\x00\x00" + data[2652:]
|
||||
BdfFontFile.BdfFontFile(io.BytesIO(data))
|
||||
data = data[:2650] + b"\x00\x00" + data[2652:]
|
||||
BdfFontFile.BdfFontFile(io.BytesIO(data))
|
||||
|
||||
|
||||
def test_invalid_file() -> None:
|
||||
|
|
Loading…
Reference in New Issue
Block a user