mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-11 17:56:18 +03:00
Added warning if defusedxml is not found
This commit is contained in:
parent
d9d811ff21
commit
0aa8bd00e7
|
@ -831,7 +831,8 @@ class TestFileJpeg:
|
|||
def test_getxmp(self):
|
||||
with Image.open("Tests/images/xmp_test.jpg") as im:
|
||||
if ElementTree is None:
|
||||
assert xmp == {}
|
||||
with pytest.warns(UserWarning):
|
||||
assert im.getxmp() == {}
|
||||
else:
|
||||
xmp = im.getxmp()
|
||||
|
||||
|
|
|
@ -659,7 +659,8 @@ class TestFilePng:
|
|||
def test_getxmp(self):
|
||||
with Image.open("Tests/images/color_snakes.png") as im:
|
||||
if ElementTree is None:
|
||||
assert im.getxmp() == {}
|
||||
with pytest.warns(UserWarning):
|
||||
assert im.getxmp() == {}
|
||||
else:
|
||||
xmp = im.getxmp()
|
||||
|
||||
|
|
|
@ -651,7 +651,8 @@ class TestFileTiff:
|
|||
def test_getxmp(self):
|
||||
with Image.open("Tests/images/lab.tif") as im:
|
||||
if ElementTree is None:
|
||||
assert im.getxmp() == {}
|
||||
with pytest.warns(UserWarning):
|
||||
assert im.getxmp() == {}
|
||||
else:
|
||||
xmp = im.getxmp()
|
||||
|
||||
|
|
|
@ -1364,6 +1364,7 @@ class Image:
|
|||
return value
|
||||
|
||||
if ElementTree is None:
|
||||
warnings.warn("XMP data cannot be read without defusedxml dependency")
|
||||
return {}
|
||||
else:
|
||||
root = ElementTree.fromstring(xmp_tags)
|
||||
|
|
Loading…
Reference in New Issue
Block a user