diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-01-26 20:42:27 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-01-26 20:42:27 +0100 |
commit | 55697d8319dc62729ef53651f2fef408f06e2d50 (patch) | |
tree | 70bef8f9ed09a04e98af1b3e76f36dcaf1986e6d /unittest/xmp.py | |
parent | 8ad3455085286b470e000b927b9dea3a6d35c2ab (diff) | |
download | pyexiv2-55697d8319dc62729ef53651f2fef408f06e2d50.tar.gz |
XMP URL and URI conversion + unit tests.
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 |