aboutsummaryrefslogtreecommitdiffstats
path: root/unittest/exif.py
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2009-03-26 09:59:08 +0100
committerOlivier Tilloy <olivier@tilloy.net>2009-03-26 09:59:08 +0100
commit938d8711997d22301718d3a181d638267abb0ef6 (patch)
treecfdb3d954d1622429d5a132d30f7f6f2220cb08b /unittest/exif.py
parentc3d3594126d448f12060a584abc622fd2148560d (diff)
downloadpyexiv2-938d8711997d22301718d3a181d638267abb0ef6.tar.gz
Delete an EXIF tag.
Diffstat (limited to 'unittest/exif.py')
-rw-r--r--unittest/exif.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/unittest/exif.py b/unittest/exif.py
index 1ce1d3c..6b463fd 100644
--- a/unittest/exif.py
+++ b/unittest/exif.py
@@ -36,6 +36,12 @@ class ImageMetadataMock(object):
def _set_exif_tag_value(self, key, value):
self.tags[key] = value
+ def _delete_exif_tag(self, key):
+ try:
+ del self.tags[key]
+ except KeyError:
+ pass
+
class TestExifTag(unittest.TestCase):
@@ -221,3 +227,21 @@ class TestExifTag(unittest.TestCase):
tag.value = 2
self.failIfEqual(tag.value, old_value)
self.assertEqual(tag.metadata.tags[tag.key], '2')
+
+ def test_del_value_no_metadata(self):
+ tag = ExifTag('Exif.Thumbnail.Orientation', 'Orientation',
+ 'Orientation', 'The image orientation viewed in terms ' \
+ 'of rows and columns.', 'Short', '1', 'top, left')
+ del tag.value
+ self.failIf(hasattr(tag, 'value'))
+
+ def test_del_value_with_metadata(self):
+ tag = ExifTag('Exif.Thumbnail.Orientation', 'Orientation',
+ 'Orientation', 'The image orientation viewed in terms ' \
+ 'of rows and columns.', 'Short', '1', 'top, left')
+ tag.metadata = ImageMetadataMock()
+ tag.metadata._set_exif_tag_value(tag.key, tag.to_string())
+ self.assertEqual(tag.metadata.tags, {tag.key: '1'})
+ del tag.value
+ self.failIf(hasattr(tag, 'value'))
+ self.failIf(tag.metadata.tags.has_key(tag.key))