aboutsummaryrefslogtreecommitdiffstats
path: root/test/pickling.py
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2010-12-22 18:21:43 +0100
committerOlivier Tilloy <olivier@tilloy.net>2010-12-22 18:21:43 +0100
commitfe2738044c3e6b0622bad3d7d295c0d0381fd300 (patch)
tree16131c7c9c3d5dc121f3eb864a7141aa7d09a677 /test/pickling.py
parent12fe3dd984c4526062c8fe426b05f1789dfe8b74 (diff)
downloadpyexiv2-fe2738044c3e6b0622bad3d7d295c0d0381fd300.tar.gz
Support pickling IPTC tags.
Diffstat (limited to 'test/pickling.py')
-rw-r--r--test/pickling.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/test/pickling.py b/test/pickling.py
index 23ce9f2..1c92e73 100644
--- a/test/pickling.py
+++ b/test/pickling.py
@@ -25,7 +25,8 @@
# ******************************************************************************
from pyexiv2.exif import ExifTag
-from pyexiv2.utils import Rational
+from pyexiv2.iptc import IptcTag
+from pyexiv2.utils import Rational, FixedOffset
import unittest
import pickle
@@ -65,3 +66,27 @@ class TestPicklingTags(unittest.TestCase):
self.assertEqual(t.value, tag.value)
self.assertEqual(t.human_value, tag.human_value)
+ def test_pickle_iptc_tag(self):
+ tags = []
+ tags.append(IptcTag('Iptc.Envelope.FileFormat', [23]))
+ tags.append(IptcTag('Iptc.Application2.Subject', ['foo', 'bar', 'baz']))
+ tags.append(IptcTag('Iptc.Envelope.DateSent', [datetime.date.today()]))
+ tags.append(IptcTag('Iptc.Envelope.TimeSent',
+ [datetime.time(23, 37, 4, tzinfo=FixedOffset('+', 6, 0))]))
+ tags.append(IptcTag('Iptc.Application2.Preview', ['01001101']))
+ for tag in tags:
+ s = pickle.dumps(tag)
+ t = pickle.loads(s)
+ self.assert_(isinstance(t, IptcTag))
+ 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.photoshop_name, tag.photoshop_name)
+ self.assertEqual(t.repeatable, tag.repeatable)
+ self.assertEqual(t.record_name, tag.record_name)
+ self.assertEqual(t.record_description, tag.record_description)
+ self.assertEqual(t.raw_value, tag.raw_value)
+ self.assertEqual(t.value, tag.value)
+