diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-02-04 20:20:53 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-02-04 20:20:53 +0100 |
commit | dc9b63f76b056a9ed4c10c701511f50da4491e09 (patch) | |
tree | f29a2c02396184909c6e51abdb072f68d5309dca /unittest/xmp.py | |
parent | 2b3f22c1710a96de655af3cb98a8191baeb802be (diff) | |
download | pyexiv2-dc9b63f76b056a9ed4c10c701511f50da4491e09.tar.gz |
XMP Integer to string conversion + unit tests.
Diffstat (limited to 'unittest/xmp.py')
-rw-r--r-- | unittest/xmp.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/unittest/xmp.py b/unittest/xmp.py index da81e03..256cd6c 100644 --- a/unittest/xmp.py +++ b/unittest/xmp.py @@ -118,6 +118,16 @@ class TestXmpTag(unittest.TestCase): self.failUnlessRaises(XmpValueError, XmpTag._convert_to_python, '47.0001', xtype) self.failUnlessRaises(XmpValueError, XmpTag._convert_to_python, '1E3', xtype) + def test_convert_to_string_integer(self): + xtype = 'Integer' + # Valid values + self.assertEqual(XmpTag._convert_to_string(123, xtype), '123') + self.assertEqual(XmpTag._convert_to_string(-57, xtype), '-57') + # Invalid values + self.failUnlessRaises(XmpValueError, XmpTag._convert_to_string, 'invalid', xtype) + self.failUnlessRaises(XmpValueError, XmpTag._convert_to_string, '3.14', xtype) + self.failUnlessRaises(XmpValueError, XmpTag._convert_to_string, '1E3', xtype) + def test_convert_to_python_langalt(self): xtype = 'Lang Alt' # Valid values |