diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-02-25 09:36:39 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-02-25 09:36:39 +0100 |
commit | 87e717129934903f87048db77cab9fd0b440757c (patch) | |
tree | b68d1620fb1deaa76918a3b0b44aacaa00545c17 /unittest | |
parent | 943641e68b1b0d50262c8008fe6a3e61151f48a2 (diff) | |
download | pyexiv2-87e717129934903f87048db77cab9fd0b440757c.tar.gz |
IPTC Date to string conversion.
Diffstat (limited to 'unittest')
-rw-r--r-- | unittest/iptc.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/unittest/iptc.py b/unittest/iptc.py index 2d747d1..dd633d7 100644 --- a/unittest/iptc.py +++ b/unittest/iptc.py @@ -86,6 +86,21 @@ class TestIptcTag(unittest.TestCase): self.failUnlessRaises(IptcValueError, IptcTag._convert_to_python, '2009-10-32', xtype) self.failUnlessRaises(IptcValueError, IptcTag._convert_to_python, '2009-02-24T22:12:54', xtype) + def test_convert_to_string_date(self): + xtype = 'Date' + # Valid values + self.assertEqual(IptcTag._convert_to_string(datetime.date(2009, 2, 4), xtype), + '20090204') + self.assertEqual(IptcTag._convert_to_string(datetime.datetime(1999, 10, 13), xtype), + '19991013') + self.assertEqual(IptcTag._convert_to_string(datetime.datetime(2009, 2, 4), xtype), + '20090204') + self.assertEqual(IptcTag._convert_to_string(datetime.datetime(2009, 2, 4, 10, 52, 37), xtype), + '20090204') + # Invalid values + self.failUnlessRaises(IptcValueError, IptcTag._convert_to_string, 'invalid', xtype) + self.failUnlessRaises(IptcValueError, IptcTag._convert_to_string, None, xtype) + def test_convert_to_python_time(self): xtype = 'Time' # Valid values |