mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 02:16:19 +03:00
Use monkeypatch
This commit is contained in:
parent
2a703a2d4c
commit
7554e2cfbf
|
@ -116,16 +116,14 @@ class TestImage:
|
|||
assert im.mode == "RGB"
|
||||
assert im.size == (128, 128)
|
||||
|
||||
def test_open_verbose_failure(self) -> None:
|
||||
def test_open_verbose_failure(self, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(Image, "WARN_POSSIBLE_FORMATS", True)
|
||||
|
||||
im = io.BytesIO(b"")
|
||||
Image.WARN_POSSIBLE_FORMATS = True
|
||||
try:
|
||||
with pytest.warns(UserWarning):
|
||||
with pytest.raises(UnidentifiedImageError):
|
||||
with Image.open(im):
|
||||
pass
|
||||
finally:
|
||||
Image.WARN_POSSIBLE_FORMATS = False
|
||||
|
||||
def test_width_height(self) -> None:
|
||||
im = Image.new("RGB", (1, 2))
|
||||
|
|
Loading…
Reference in New Issue
Block a user