diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-02-24 19:54:14 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-02-24 19:54:14 +0100 |
commit | 9564f01d928d2a654a4dd3933025e20266adddab (patch) | |
tree | 48de0b3a146ffa8c755749f4d1769133b76cb6ea /unittest/iptc.py | |
parent | b7dfe1a41b0afca712384d67271fef0a4a860df4 (diff) | |
download | pyexiv2-9564f01d928d2a654a4dd3933025e20266adddab.tar.gz |
IPTC Short to string conversion.
Diffstat (limited to 'unittest/iptc.py')
-rw-r--r-- | unittest/iptc.py | 10 |
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 |