Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Tests/test_file_bmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ def test_rle8() -> None:
# Signal end of bitmap before the image is finished
with open("Tests/images/bmp/g/pal8rle.bmp", "rb") as fp:
data = fp.read(1063) + b"\x01"
with Image.open(io.BytesIO(data)) as im:
with pytest.raises(ValueError):
im.load()
with Image.open(io.BytesIO(data)) as im:
with pytest.raises(ValueError):
im.load()


def test_rle4() -> None:
Expand All @@ -214,9 +214,9 @@ def test_rle4() -> None:
def test_rle8_eof(file_name: str, length: int) -> None:
with open(file_name, "rb") as fp:
data = fp.read(length)
with Image.open(io.BytesIO(data)) as im:
with pytest.raises(ValueError):
im.load()
with Image.open(io.BytesIO(data)) as im:
with pytest.raises(ValueError):
im.load()


def test_offset() -> None:
Expand Down
4 changes: 2 additions & 2 deletions Tests/test_file_jpeg2k.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@ def test_comment() -> None:
# Test an image that is truncated partway through a codestream
with open("Tests/images/comment.jp2", "rb") as fp:
b = BytesIO(fp.read(130))
with Image.open(b) as im:
pass
with Image.open(b) as im:
pass


def test_save_comment(card: ImageFile.ImageFile) -> None:
Expand Down
12 changes: 6 additions & 6 deletions Tests/test_file_libtiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_g4_tiff_bytesio(self, tmp_path: Path) -> None:
s = io.BytesIO()
with open(test_file, "rb") as f:
s.write(f.read())
s.seek(0)
s.seek(0)
with Image.open(s) as im:
assert im.size == (500, 500)
self._assert_noerr(tmp_path, im)
Expand Down Expand Up @@ -1050,12 +1050,12 @@ def test_old_style_jpeg_orientation(self) -> None:
with open("Tests/images/old-style-jpeg-compression.tif", "rb") as fp:
data = fp.read()

# Set EXIF Orientation to 2
data = data[:102] + b"\x02" + data[103:]
# Set EXIF Orientation to 2
data = data[:102] + b"\x02" + data[103:]

with Image.open(io.BytesIO(data)) as im:
im = im.transpose(Image.Transpose.FLIP_LEFT_RIGHT)
assert_image_equal_tofile(im, "Tests/images/old-style-jpeg-compression.png")
with Image.open(io.BytesIO(data)) as im:
im = im.transpose(Image.Transpose.FLIP_LEFT_RIGHT)
assert_image_equal_tofile(im, "Tests/images/old-style-jpeg-compression.png")

def test_open_missing_samplesperpixel(self) -> None:
with Image.open(
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_libtiff_small.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_g4_hopper_bytesio(self, tmp_path: Path) -> None:
s = BytesIO()
with open(test_file, "rb") as f:
s.write(f.read())
s.seek(0)
s.seek(0)
with Image.open(s) as im:
assert im.size == (128, 128)
self._assert_noerr(tmp_path, im)
Expand Down
Loading