diff options
-rw-r--r-- | src/pyexiv2.py | 2 | ||||
-rw-r--r-- | unittest/metadata.py | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py index 902301e..ba1734a 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -1051,7 +1051,7 @@ class ImageMetadata(object): self._tags['xmp'][key] = tag return tag - def get(self, key): + def __getitem__(self, key): """ Get a metadata tag for a given key. DOCME diff --git a/unittest/metadata.py b/unittest/metadata.py index 029774a..661a5be 100644 --- a/unittest/metadata.py +++ b/unittest/metadata.py @@ -319,23 +319,23 @@ class TestImageMetadata(unittest.TestCase): key = 'Xmp.xmp.Label' self.failUnlessRaises(KeyError, self.metadata._get_xmp_tag, key) - def test_get(self): + def test_getitem(self): self.metadata.read() self._set_exif_tags() self._set_iptc_tags() self._set_xmp_tags() # Get existing tags key = 'Exif.Photo.ExifVersion' - tag = self.metadata.get(key) + tag = self.metadata[key] self.assertEqual(type(tag), ExifTag) key = 'Iptc.Application2.Caption' - tag = self.metadata.get(key) + tag = self.metadata[key] self.assertEqual(type(tag), IptcTag) key = 'Xmp.xmp.CreateDate' - tag = self.metadata.get(key) + tag = self.metadata[key] self.assertEqual(type(tag), XmpTag) # Try to get nonexistent tags keys = ('Exif.Image.SamplesPerPixel', 'Iptc.Application2.FixtureId', 'Xmp.xmp.Rating', 'Wrong.Noluck.Raise') for key in keys: - self.failUnlessRaises(KeyError, self.metadata.get, key) + self.failUnlessRaises(KeyError, self.metadata.__getitem__, key) |