aboutsummaryrefslogtreecommitdiffstats
path: root/unittest
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2009-02-04 20:30:37 +0100
committerOlivier Tilloy <olivier@tilloy.net>2009-02-04 20:30:37 +0100
commitc6501e454229132808853648b818499ea4888f58 (patch)
tree2205480030a9f9665264f0ce1056a1b53523e613 /unittest
parentdc9b63f76b056a9ed4c10c701511f50da4491e09 (diff)
downloadpyexiv2-c6501e454229132808853648b818499ea4888f58.tar.gz
XMP MIMEType to string conversion + unit tests.
Diffstat (limited to 'unittest')
-rw-r--r--unittest/xmp.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/unittest/xmp.py b/unittest/xmp.py
index 256cd6c..5814173 100644
--- a/unittest/xmp.py
+++ b/unittest/xmp.py
@@ -156,6 +156,15 @@ class TestXmpTag(unittest.TestCase):
self.failUnlessRaises(XmpValueError, XmpTag._convert_to_python, 'invalid', xtype)
self.failUnlessRaises(XmpValueError, XmpTag._convert_to_python, 'image-jpeg', xtype)
+ def test_convert_to_string_mimetype(self):
+ xtype = 'MIMEType'
+ # Valid values
+ self.assertEqual(XmpTag._convert_to_string({'type': 'image', 'subtype': 'jpeg'}, xtype), 'image/jpeg')
+ self.assertEqual(XmpTag._convert_to_string({'type': 'video', 'subtype': 'ogg'}, xtype), 'video/ogg')
+ # Invalid values
+ self.failUnlessRaises(XmpValueError, XmpTag._convert_to_string, 'invalid', xtype)
+ self.failUnlessRaises(XmpValueError, XmpTag._convert_to_string, {'type': 'image'}, xtype)
+
def test_convert_to_python_propername(self):
xtype = 'ProperName'
# Valid values