diff options
-rw-r--r-- | src/pyexiv2.py | 5 | ||||
-rw-r--r-- | unittest/xmp.py | 10 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py index c679302..012dc54 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -588,14 +588,11 @@ class XmpTag(MetadataTag): else: return {'type': mtype, 'subtype': msubtype} - elif xtype == 'ProperName': - # TODO - return value elif xtype == 'Real': # TODO return value - elif xtype == 'Text': + elif xtype in ('ProperName', 'Text'): try: return unicode(value, 'utf-8') except TypeError: diff --git a/unittest/xmp.py b/unittest/xmp.py index 41cf6b3..27b355d 100644 --- a/unittest/xmp.py +++ b/unittest/xmp.py @@ -127,6 +127,13 @@ class TestXmpTag(unittest.TestCase): self.assertEqual(XmpTag._convert_to_python('invalid', xtype), 'invalid') self.assertEqual(XmpTag._convert_to_python('image-jpeg', xtype), 'image-jpeg') + def test_convert_to_python_propername(self): + xtype = 'ProperName' + # Valid values + self.assertEqual(XmpTag._convert_to_python('Gérard', xtype), u'Gérard') + self.assertEqual(XmpTag._convert_to_python(u'François Pignon', xtype), u'François Pignon') + self.assertEqual(XmpTag._convert_to_python('Python Software Foundation', xtype), u'Python Software Foundation') + def test_convert_to_python_text(self): xtype = 'Text' # Valid values @@ -136,9 +143,6 @@ class TestXmpTag(unittest.TestCase): u'Some text with exotic chàräctérʐ.') self.assertEqual(XmpTag._convert_to_python(u'Some text with exotic chàräctérʐ.', xtype), u'Some text with exotic chàräctérʐ.') - # Invalid values - 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' |