File tree 2 files changed +8
-8
lines changed 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 2
2
3
3
4
4
def test_getxmp ():
5
- im = Image .open ("Tests/images/xmp_test.jpg" )
6
- type_repr = repr ( type ( im .getxmp ()) )
5
+ with Image .open ("Tests/images/xmp_test.jpg" ) as im :
6
+ xmp = im .getxmp ()
7
7
8
- assert "dict" in type_repr
9
- assert isinstance ( im . getxmp () ["Description" ][0 ][ "Version" ], str )
8
+ assert isinstance ( xmp , dict )
9
+ assert xmp ["Description" ]["Version" ] == "10.4"
Original file line number Diff line number Diff line change @@ -1334,10 +1334,10 @@ def getxmp(self):
1334
1334
if marker == b"http://ns.adobe.com/xap/1.0/" :
1335
1335
root = xml .etree .ElementTree .fromstring (xmp_tags )
1336
1336
for element in root .findall (".//" ):
1337
- xmp_atribs = []
1338
- for child , value in element . attrib . items ():
1339
- xmp_atribs . append ({ child . split ( "}" )[ 1 ]: value } )
1340
- self . _xmp . update ({ element . tag . split ( "}" )[ 1 ]: xmp_atribs })
1337
+ self . _xmp [ element . tag . split ( "}" )[ 1 ]] = {
1338
+ child . split ( "}" )[ 1 ]: value
1339
+ for child , value in element . attrib . items ( )
1340
+ }
1341
1341
return self ._xmp
1342
1342
1343
1343
def getim (self ):
You can’t perform that action at this time.
0 commit comments