diff options
Diffstat (limited to 'unittest/xmp.py')
-rw-r--r-- | unittest/xmp.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/unittest/xmp.py b/unittest/xmp.py index 8663f64..41cf6b3 100644 --- a/unittest/xmp.py +++ b/unittest/xmp.py @@ -28,7 +28,6 @@ import unittest from pyexiv2 import XmpTag, FixedOffset import datetime - class TestXmpTag(unittest.TestCase): def test_convert_to_python_boolean(self): @@ -141,4 +140,22 @@ class TestXmpTag(unittest.TestCase): self.assertEqual(XmpTag._convert_to_python(12, xtype), 12) self.assertEqual(XmpTag._convert_to_python(3.14, xtype), 3.14) + def test_convert_to_python_uri(self): + xtype = 'URI' + # Valid values + self.assertEqual(XmpTag._convert_to_python('http://example.com', xtype), 'http://example.com') + self.assertEqual(XmpTag._convert_to_python('https://example.com', xtype), 'https://example.com') + self.assertEqual(XmpTag._convert_to_python('http://localhost:8000/resource', xtype), + 'http://localhost:8000/resource') + self.assertEqual(XmpTag._convert_to_python('uuid:9A3B7F52214211DAB6308A7391270C13', xtype), + 'uuid:9A3B7F52214211DAB6308A7391270C13') + + def test_convert_to_python_url(self): + xtype = 'URL' + # Valid values + self.assertEqual(XmpTag._convert_to_python('http://example.com', xtype), 'http://example.com') + self.assertEqual(XmpTag._convert_to_python('https://example.com', xtype), 'https://example.com') + self.assertEqual(XmpTag._convert_to_python('http://localhost:8000/resource', xtype), + 'http://localhost:8000/resource') + # TODO: other types |