aboutsummaryrefslogtreecommitdiffstats
path: root/unittest/xmp.py
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2009-01-26 09:09:43 +0100
committerOlivier Tilloy <olivier@tilloy.net>2009-01-26 09:09:43 +0100
commit5df2b0deb5c6fb13e9401b4fb3f4accdee1711b4 (patch)
tree6e35aed008cf6ac4b26cb4c0ab41c9b24ede0740 /unittest/xmp.py
parentc3d4e471123d05d297e43921121fc9fbce8cb8da (diff)
downloadpyexiv2-5df2b0deb5c6fb13e9401b4fb3f4accdee1711b4.tar.gz
XMP LangAlt conversion + unit tests.
Diffstat (limited to 'unittest/xmp.py')
-rw-r--r--unittest/xmp.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/unittest/xmp.py b/unittest/xmp.py
index 02dd938..7f8f916 100644
--- a/unittest/xmp.py
+++ b/unittest/xmp.py
@@ -100,6 +100,23 @@ class TestXmpTag(unittest.TestCase):
self.assertEqual(XmpTag._convert_to_python('47.0001', xtype), '47.0001')
self.assertEqual(XmpTag._convert_to_python('1E3', xtype), '1E3')
+ def test_convert_to_python_langalt(self):
+ xtype = 'Lang Alt'
+ # Valid values
+ self.assertEqual(XmpTag._convert_to_python('lang="x-default" some text', xtype),
+ {'x-default': 'some text'})
+ self.assertEqual(XmpTag._convert_to_python('lang="x-default" some text, lang="fr-FR" du texte', xtype),
+ {'x-default': 'some text', 'fr-FR': 'du texte'})
+ self.assertEqual(XmpTag._convert_to_python('lang="x-default" some text , lang="fr-FR" du texte ', xtype),
+ {'x-default': 'some text ', 'fr-FR': ' du texte '})
+ self.assertEqual(XmpTag._convert_to_python('lang="x-default" some text, lang="fr-FR" du texte, lang="es-ES" un texto', xtype),
+ {'x-default': 'some text', 'fr-FR': 'du texte', 'es-ES': 'un texto'})
+ # Invalid values
+ self.assertEqual(XmpTag._convert_to_python('invalid', xtype), 'invalid')
+ self.assertEqual(XmpTag._convert_to_python('lang="malformed', xtype), 'lang="malformed')
+ self.assertEqual(XmpTag._convert_to_python('xlang="x-default" some text', xtype), 'xlang="x-default" some text')
+ self.assertEqual(XmpTag._convert_to_python('lang="x-default" some text, xlang="fr-FR" du texte', xtype), 'lang="x-default" some text, xlang="fr-FR" du texte')
+
def test_convert_to_python_mimetype(self):
xtype = 'MIMEType'
# Valid values