aboutsummaryrefslogtreecommitdiffstats
path: root/unittest/xmp.py
diff options
context:
space:
mode:
Diffstat (limited to 'unittest/xmp.py')
-rw-r--r--unittest/xmp.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/unittest/xmp.py b/unittest/xmp.py
index 1ee2c99..e770b06 100644
--- a/unittest/xmp.py
+++ b/unittest/xmp.py
@@ -33,11 +33,25 @@ class TestXmpTag(unittest.TestCase):
def test_convert_to_python_bag(self):
xtype = 'bag Text'
# Valid values
- self.assertEqual(XmpTag._convert_to_python('', xtype), [u''])
+ self.assertEqual(XmpTag._convert_to_python('', xtype), [])
self.assertEqual(XmpTag._convert_to_python('One value only', xtype), [u'One value only'])
self.assertEqual(XmpTag._convert_to_python('Some, text, keyword, this is a test', xtype),
[u'Some', u'text', u'keyword', u'this is a test'])
+ def test_convert_to_string_bag(self):
+ xtype = 'bag Text'
+ # Valid values
+ self.assertEqual(XmpTag._convert_to_string([], xtype), '')
+ self.assertEqual(XmpTag._convert_to_string(['One value only'], xtype), 'One value only')
+ self.assertEqual(XmpTag._convert_to_string([u'One value only'], xtype), 'One value only')
+ self.assertEqual(XmpTag._convert_to_string([u'Some', u'text', u'keyword', u'this is a test'], xtype),
+ 'Some, text, keyword, this is a test')
+ self.assertEqual(XmpTag._convert_to_string(['Some ', ' text '], xtype),
+ 'Some , text ')
+ # Invalid values
+ self.failUnlessRaises(XmpValueError, XmpTag._convert_to_string, 'invalid', xtype)
+ self.failUnlessRaises(XmpValueError, XmpTag._convert_to_string, [1, 2, 3], xtype)
+
def test_convert_to_python_boolean(self):
xtype = 'Boolean'
# Valid values