mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +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:
|
def test_getxmp() -> None:
|
||||||
with Image.open("Tests/images/flower.webp") as im:
|
with Image.open("Tests/images/flower.webp") as im:
|
||||||
assert "xmp" not in im.info
|
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:
|
with Image.open("Tests/images/flower2.webp") as im:
|
||||||
if ElementTree is None:
|
if ElementTree is None:
|
||||||
|
|
|
@ -938,7 +938,15 @@ class TestImage:
|
||||||
|
|
||||||
def test_empty_xmp(self) -> None:
|
def test_empty_xmp(self) -> None:
|
||||||
with Image.open("Tests/images/hopper.gif") as im:
|
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:
|
def test_getxmp_padded(self) -> None:
|
||||||
im = Image.new("RGB", (1, 1))
|
im = Image.new("RGB", (1, 1))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user