diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-08-04 20:34:45 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-08-04 20:34:45 +0200 |
commit | bedad87240fdc63dc37c1fd859642284eed63a74 (patch) | |
tree | 042cdc628bf2454eb84ce97387b8e9801435064e /unittest/exif.py | |
parent | 9e0d90e6e337faceaa75bb61888785c3afe9f028 (diff) | |
download | pyexiv2-bedad87240fdc63dc37c1fd859642284eed63a74.tar.gz |
Correctly handle decoding/encoding Exif.GPSInfo.GPSDateStamp.
Diffstat (limited to 'unittest/exif.py')
-rw-r--r-- | unittest/exif.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/unittest/exif.py b/unittest/exif.py index 32e2a44..287e56d 100644 --- a/unittest/exif.py +++ b/unittest/exif.py @@ -66,6 +66,11 @@ class TestExifTag(unittest.TestCase): self.assertEqual(tag._convert_to_python('2009-03-01T12:46:51Z'), datetime.datetime(2009, 03, 01, 12, 46, 51)) + # Valid values: dates + tag = ExifTagMock('Exif.GPSInfo.GPSDateStamp', type) + self.assertEqual(tag._convert_to_python('2009:08:04'), + datetime.date(2009, 8, 4)) + # Valid values: strings tag = ExifTagMock('Exif.Image.Copyright', type) self.assertEqual(tag._convert_to_python('Some text.'), u'Some text.') @@ -78,6 +83,11 @@ class TestExifTag(unittest.TestCase): u'2009-13-01 12:46:51') self.assertEqual(tag._convert_to_python('2009-12-01'), u'2009-12-01') + # Invalid values: dates + tag = ExifTagMock('Exif.GPSInfo.GPSDateStamp', type) + self.assertEqual(tag._convert_to_python('2009:13:01'), u'2009:13:01') + self.assertEqual(tag._convert_to_python('2009-12-01'), u'2009-12-01') + def test_convert_to_string_ascii(self): type = 'Ascii' @@ -88,6 +98,11 @@ class TestExifTag(unittest.TestCase): self.assertEqual(tag._convert_to_string(datetime.date(2009, 03, 01)), '2009:03:01 00:00:00') + # Valid values: dates + tag = ExifTagMock('Exif.GPSInfo.GPSDateStamp', type) + self.assertEqual(tag._convert_to_string(datetime.date(2009, 03, 01)), + '2009:03:01') + # Valid values: strings tag = ExifTagMock('Exif.Image.Copyright', type) self.assertEqual(tag._convert_to_string(u'Some text'), 'Some text') |