mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 13:14:27 +03:00
Catch defusedxml warnings
This commit is contained in:
parent
d6cfebd016
commit
fed9168252
|
@ -116,7 +116,15 @@ def test_read_no_exif() -> None:
|
|||
def test_getxmp() -> None:
|
||||
with Image.open("Tests/images/flower.webp") as im:
|
||||
assert "xmp" not in im.info
|
||||
assert im.getxmp() == {}
|
||||
if ElementTree is None:
|
||||
with pytest.warns(
|
||||
UserWarning,
|
||||
match="XMP data cannot be read without defusedxml dependency",
|
||||
):
|
||||
xmp = im.getxmp()
|
||||
else:
|
||||
xmp = im.getxmp()
|
||||
assert xmp == {}
|
||||
|
||||
with Image.open("Tests/images/flower2.webp") as im:
|
||||
if ElementTree is None:
|
||||
|
|
|
@ -938,7 +938,15 @@ class TestImage:
|
|||
|
||||
def test_empty_xmp(self) -> None:
|
||||
with Image.open("Tests/images/hopper.gif") as im:
|
||||
assert im.getxmp() == {}
|
||||
if ElementTree is None:
|
||||
with pytest.warns(
|
||||
UserWarning,
|
||||
match="XMP data cannot be read without defusedxml dependency",
|
||||
):
|
||||
xmp = im.getxmp()
|
||||
else:
|
||||
xmp = im.getxmp()
|
||||
assert xmp == {}
|
||||
|
||||
def test_getxmp_padded(self) -> None:
|
||||
im = Image.new("RGB", (1, 1))
|
||||
|
|
Loading…
Reference in New Issue
Block a user