aboutsummaryrefslogtreecommitdiffstats
path: root/test/metadata.py
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2010-05-21 20:31:42 +0200
committerOlivier Tilloy <olivier@tilloy.net>2010-05-21 20:31:42 +0200
commit59797a333d118cf12ba5d16a89993e5e85938f18 (patch)
tree7b1e096bb846c05770d590c50405ba36e7817643 /test/metadata.py
parentf33e97cce19571f9470787c56541800eeb87f6e6 (diff)
downloadpyexiv2-59797a333d118cf12ba5d16a89993e5e85938f18.tar.gz
Unit tests for the image comment.
Diffstat (limited to 'test/metadata.py')
-rw-r--r--test/metadata.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/metadata.py b/test/metadata.py
index a501c8c..98be0be 100644
--- a/test/metadata.py
+++ b/test/metadata.py
@@ -71,6 +71,7 @@ class TestImageMetadata(unittest.TestCase):
m['Iptc.Application2.DateCreated'] = [datetime.date(2004, 7, 13)]
m['Xmp.dc.format'] = ('image', 'jpeg')
m['Xmp.dc.subject'] = ['image', 'test', 'pyexiv2']
+ m.comment = 'Hello World!'
m.write()
self.metadata = ImageMetadata(self.pathname)
@@ -490,6 +491,27 @@ class TestImageMetadata(unittest.TestCase):
for key in keys:
self.failUnlessRaises(KeyError, self.metadata.__delitem__, key)
+ ##########################
+ # Test the image comment #
+ ##########################
+
+ def test_get_comment(self):
+ self.metadata.read()
+ self.failUnlessEqual(self.metadata.comment, 'Hello World!')
+
+ def test_set_comment(self):
+ self.metadata.read()
+ comment = 'Welcome to the real world.'
+ self.metadata.comment = comment
+ self.failUnlessEqual(self.metadata.comment, comment)
+ self.metadata.comment = None
+ self.failUnlessEqual(self.metadata.comment, '')
+
+ def test_delete_comment(self):
+ self.metadata.read()
+ del self.metadata.comment
+ self.failUnlessEqual(self.metadata.comment, '')
+
####################
# Test metadata copy
####################
@@ -524,3 +546,5 @@ class TestImageMetadata(unittest.TestCase):
for key in self.metadata.xmp_keys:
self.failUnlessEqual(self.metadata[key].value, self.other[key].value)
+ self.failUnlessEqual(self.metadata.comment, self.other.comment)
+