diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2010-12-22 18:38:26 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2010-12-22 18:38:26 +0100 |
commit | 51057f871adbc671546bb13f8bc7f7e2d25dad09 (patch) | |
tree | df72aab1d5e02fa9b5568497bd54dbc5d13cf392 /test/pickling.py | |
parent | fe2738044c3e6b0622bad3d7d295c0d0381fd300 (diff) | |
download | pyexiv2-51057f871adbc671546bb13f8bc7f7e2d25dad09.tar.gz |
Support pickling XMP tags.
Diffstat (limited to 'test/pickling.py')
-rw-r--r-- | test/pickling.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/pickling.py b/test/pickling.py index 1c92e73..d98c146 100644 --- a/test/pickling.py +++ b/test/pickling.py @@ -26,6 +26,7 @@ from pyexiv2.exif import ExifTag from pyexiv2.iptc import IptcTag +from pyexiv2.xmp import XmpTag from pyexiv2.utils import Rational, FixedOffset import unittest @@ -90,3 +91,27 @@ class TestPicklingTags(unittest.TestCase): self.assertEqual(t.raw_value, tag.raw_value) self.assertEqual(t.value, tag.value) + def test_pickle_xmp_tag(self): + tags = [] + tags.append(XmpTag('Xmp.dc.subject', ['foo', 'bar', 'baz'])) + tags.append(XmpTag('Xmp.xmpRights.Marked', True)) + tags.append(XmpTag('Xmp.xmp.CreateDate', datetime.date.today())) + tags.append(XmpTag('Xmp.xmpMM.SaveID', 34)) + tags.append(XmpTag('Xmp.dc.format', ('image', 'jpeg'))) + tags.append(XmpTag('Xmp.photoshop.CaptionWriter', 'John Doe')) + tags.append(XmpTag('Xmp.dc.source', 'bleh')) + tags.append(XmpTag('Xmp.xmpMM.DocumentID', 'http://example.com')) + tags.append(XmpTag('Xmp.xmp.BaseURL', 'http://example.com')) + tags.append(XmpTag('Xmp.xmpDM.videoPixelAspectRatio', Rational(5, 3))) + for tag in tags: + s = pickle.dumps(tag) + t = pickle.loads(s) + self.assert_(isinstance(t, XmpTag)) + self.assertEqual(t.key, tag.key) + self.assertEqual(t.type, tag.type) + self.assertEqual(t.name, tag.name) + self.assertEqual(t.title, tag.title) + self.assertEqual(t.description, tag.description) + self.assertEqual(t.raw_value, tag.raw_value) + self.assertEqual(t.value, tag.value) + |