aboutsummaryrefslogtreecommitdiffstats
path: root/unittest/iptc.py
diff options
context:
space:
mode:
Diffstat (limited to 'unittest/iptc.py')
-rw-r--r--unittest/iptc.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/unittest/iptc.py b/unittest/iptc.py
index dee5383..c0ed7d7 100644
--- a/unittest/iptc.py
+++ b/unittest/iptc.py
@@ -43,6 +43,16 @@ class TestIptcTag(unittest.TestCase):
self.failUnlessRaises(IptcValueError, IptcTag._convert_to_python, '47.0001', xtype)
self.failUnlessRaises(IptcValueError, IptcTag._convert_to_python, '1E3', xtype)
+ def test_convert_to_string_short(self):
+ xtype = 'Short'
+ # Valid values
+ self.assertEqual(IptcTag._convert_to_string(123, xtype), '123')
+ self.assertEqual(IptcTag._convert_to_string(-57, xtype), '-57')
+ # Invalid values
+ self.failUnlessRaises(IptcValueError, IptcTag._convert_to_string, 'invalid', xtype)
+ self.failUnlessRaises(IptcValueError, IptcTag._convert_to_string, '3.14', xtype)
+ self.failUnlessRaises(IptcValueError, IptcTag._convert_to_string, '1E3', xtype)
+
def test_convert_to_python_string(self):
xtype = 'String'
# Valid values