diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-04-22 20:14:36 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-04-22 20:14:36 +0200 |
commit | f629259e03df06bc710d643a846aa9d03b0c0af2 (patch) | |
tree | 367192c9e50a4ac98c4043f10179708bde8297ef /unittest | |
parent | fc159fa96a9a0d77f21891659e0ea8bc5b3b9f66 (diff) | |
download | pyexiv2-f629259e03df06bc710d643a846aa9d03b0c0af2.tar.gz |
Dictionary-like deletion for tags: unit tests.
Diffstat (limited to 'unittest')
-rw-r--r-- | unittest/metadata.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/unittest/metadata.py b/unittest/metadata.py index 6d106ec..14850e4 100644 --- a/unittest/metadata.py +++ b/unittest/metadata.py @@ -666,5 +666,22 @@ class TestImageMetadata(unittest.TestCase): self.failUnlessEqual(self.metadata._tags['xmp'][key], tag) def test_delitem(self): - # TODO - raise(NotImplementedError()) + self.metadata.read() + self._set_exif_tags() + self._set_iptc_tags() + self._set_xmp_tags() + # Delete existing tags + key = 'Exif.Photo.ExifVersion' + del self.metadata[key] + self.failIf(key in self.metadata._tags['exif']) + key = 'Iptc.Application2.Caption' + del self.metadata[key] + self.failIf(key in self.metadata._tags['iptc']) + key = 'Xmp.xmp.CreateDate' + del self.metadata[key] + self.failIf(key in self.metadata._tags['xmp']) + # Try to delete nonexistent tags + keys = ('Exif.Image.SamplesPerPixel', 'Iptc.Application2.FixtureId', + 'Xmp.xmp.Rating', 'Wrong.Noluck.Raise') + for key in keys: + self.failUnlessRaises(KeyError, self.metadata.__delitem__, key) |