mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-30 01:43:17 +03:00
Added context managers
This commit is contained in:
parent
b6f6fba8cf
commit
41a439da7d
|
@ -56,7 +56,8 @@ def test_not_ppm(tmp_path):
|
||||||
f.write(b"PyInvalid")
|
f.write(b"PyInvalid")
|
||||||
|
|
||||||
with pytest.raises(UnidentifiedImageError):
|
with pytest.raises(UnidentifiedImageError):
|
||||||
Image.open(path)
|
with Image.open(path):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def test_header_with_comments(tmp_path):
|
def test_header_with_comments(tmp_path):
|
||||||
|
@ -74,7 +75,8 @@ def test_nondecimal_header(tmp_path):
|
||||||
f.write(b"P6\n128\x00")
|
f.write(b"P6\n128\x00")
|
||||||
|
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
Image.open(path)
|
with Image.open(path):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def test_token_too_long(tmp_path):
|
def test_token_too_long(tmp_path):
|
||||||
|
@ -83,7 +85,8 @@ def test_token_too_long(tmp_path):
|
||||||
f.write(b"P6\n 0123456789")
|
f.write(b"P6\n 0123456789")
|
||||||
|
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
Image.open(path)
|
with Image.open(path):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def test_too_many_colors(tmp_path):
|
def test_too_many_colors(tmp_path):
|
||||||
|
@ -92,7 +95,8 @@ def test_too_many_colors(tmp_path):
|
||||||
f.write(b"P6\n1 1\n1000\n")
|
f.write(b"P6\n1 1\n1000\n")
|
||||||
|
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
Image.open(path)
|
with Image.open(path):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def test_truncated_file(tmp_path):
|
def test_truncated_file(tmp_path):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user