aboutsummaryrefslogtreecommitdiffstats
path: root/unittest/xmp.py
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2009-02-06 18:59:10 +0100
committerOlivier Tilloy <olivier@tilloy.net>2009-02-06 18:59:10 +0100
commit1e3ce8ad1f2bfb030665523001aa4bec718a1b6d (patch)
tree5e1756d815658a43a8e8c3481c47340e47cab30a /unittest/xmp.py
parent0470d9eca9935aa8127933a1867c7bf63484b73a (diff)
downloadpyexiv2-1e3ce8ad1f2bfb030665523001aa4bec718a1b6d.tar.gz
XMP URI and URL to string conversion + unit tests.
Diffstat (limited to 'unittest/xmp.py')
-rw-r--r--unittest/xmp.py30
1 files changed, 24 insertions, 6 deletions
diff --git a/unittest/xmp.py b/unittest/xmp.py
index 97e2eda..1ee2c99 100644
--- a/unittest/xmp.py
+++ b/unittest/xmp.py
@@ -56,12 +56,6 @@ class TestXmpTag(unittest.TestCase):
self.failUnlessRaises(XmpValueError, XmpTag._convert_to_string, 'invalid', xtype)
self.failUnlessRaises(XmpValueError, XmpTag._convert_to_string, None, xtype)
- def test_convert_to_python_choice(self):
- pass
-
- def test_convert_to_python_colorant(self):
- pass
-
def test_convert_to_python_date(self):
xtype = 'Date'
# Valid values
@@ -261,6 +255,19 @@ class TestXmpTag(unittest.TestCase):
self.assertEqual(XmpTag._convert_to_python('uuid:9A3B7F52214211DAB6308A7391270C13', xtype),
'uuid:9A3B7F52214211DAB6308A7391270C13')
+ def test_convert_to_string_uri(self):
+ xtype = 'URI'
+ # Valid values
+ self.assertEqual(XmpTag._convert_to_string('http://example.com', xtype), 'http://example.com')
+ self.assertEqual(XmpTag._convert_to_string(u'http://example.com', xtype), 'http://example.com')
+ self.assertEqual(XmpTag._convert_to_string('https://example.com', xtype), 'https://example.com')
+ self.assertEqual(XmpTag._convert_to_string('http://localhost:8000/resource', xtype),
+ 'http://localhost:8000/resource')
+ self.assertEqual(XmpTag._convert_to_string('uuid:9A3B7F52214211DAB6308A7391270C13', xtype),
+ 'uuid:9A3B7F52214211DAB6308A7391270C13')
+ # Invalid values
+ self.failUnlessRaises(XmpValueError, XmpTag._convert_to_string, None, xtype)
+
def test_convert_to_python_url(self):
xtype = 'URL'
# Valid values
@@ -269,4 +276,15 @@ class TestXmpTag(unittest.TestCase):
self.assertEqual(XmpTag._convert_to_python('http://localhost:8000/resource', xtype),
'http://localhost:8000/resource')
+ def test_convert_to_string_url(self):
+ xtype = 'URL'
+ # Valid values
+ self.assertEqual(XmpTag._convert_to_string('http://example.com', xtype), 'http://example.com')
+ self.assertEqual(XmpTag._convert_to_string(u'http://example.com', xtype), 'http://example.com')
+ self.assertEqual(XmpTag._convert_to_string('https://example.com', xtype), 'https://example.com')
+ self.assertEqual(XmpTag._convert_to_string('http://localhost:8000/resource', xtype),
+ 'http://localhost:8000/resource')
+ # Invalid values
+ self.failUnlessRaises(XmpValueError, XmpTag._convert_to_string, None, xtype)
+
# TODO: other types