aboutsummaryrefslogtreecommitdiffstats
path: root/test/exif.py
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2010-01-17 12:08:19 +0100
committerOlivier Tilloy <olivier@tilloy.net>2010-01-17 12:08:19 +0100
commitbf44e3a8746b21dec56f1f8c61c077e36e4c03cd (patch)
treecbdf196e26dd9183fddd9a006281ffe5b21e53b9 /test/exif.py
parent39ef8d00c9e7f45791e1a76d63edec30b9ff4297 (diff)
downloadpyexiv2-bf44e3a8746b21dec56f1f8c61c077e36e4c03cd.tar.gz
Support the EXIF SShort type (handled similarly as Short).
This doesn't seem to be standard EXIF but it is mentioned in the TIFF specification.
Diffstat (limited to 'test/exif.py')
-rw-r--r--test/exif.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/exif.py b/test/exif.py
index cd077cd..6cb4f77 100644
--- a/test/exif.py
+++ b/test/exif.py
@@ -162,6 +162,31 @@ class TestExifTag(unittest.TestCase):
self.failUnlessRaises(ExifValueError, tag._convert_to_string, 'invalid')
self.failUnlessRaises(ExifValueError, tag._convert_to_string, 3.14)
+ def test_convert_to_python_sshort(self):
+ # Valid values
+ tag = ExifTag('Exif.Image.TimeZoneOffset')
+ self.assertEqual(tag.type, 'SShort')
+ self.assertEqual(tag._convert_to_python('8'), 8)
+ self.assertEqual(tag._convert_to_python('+5'), 5)
+ self.assertEqual(tag._convert_to_python('-6'), -6)
+
+ # Invalid values
+ self.failUnlessRaises(ExifValueError, tag._convert_to_python, 'abc')
+ self.failUnlessRaises(ExifValueError, tag._convert_to_python, '5,64')
+ self.failUnlessRaises(ExifValueError, tag._convert_to_python, '47.0001')
+ self.failUnlessRaises(ExifValueError, tag._convert_to_python, '1E3')
+
+ def test_convert_to_string_sshort(self):
+ # Valid values
+ tag = ExifTag('Exif.Image.TimeZoneOffset')
+ self.assertEqual(tag.type, 'SShort')
+ self.assertEqual(tag._convert_to_string(12), '12')
+ self.assertEqual(tag._convert_to_string(-3), '-3')
+
+ # Invalid values
+ self.failUnlessRaises(ExifValueError, tag._convert_to_string, 'invalid')
+ self.failUnlessRaises(ExifValueError, tag._convert_to_string, 3.14)
+
def test_convert_to_python_long(self):
# Valid values
tag = ExifTag('Exif.Image.ImageWidth')