Merge pull request #199 from thekad/bug/empty-iso-speed-ratings
Empty ISO speed ratings
This commit is contained in:
@@ -270,7 +270,7 @@ def get_exif_tags(data):
|
||||
else:
|
||||
logger.info('Unknown format for ExposureTime: %r', exptime)
|
||||
|
||||
if 'ISOSpeedRatings' in data:
|
||||
if 'ISOSpeedRatings' in data and data['ISOSpeedRatings']:
|
||||
if isinstance(data['ISOSpeedRatings'], tuple):
|
||||
# Pillow == 3.0
|
||||
simple['iso'] = data['ISOSpeedRatings'][0]
|
||||
|
||||
@@ -137,6 +137,20 @@ def test_get_exif_tags():
|
||||
assert 'gps' not in simple
|
||||
|
||||
|
||||
def test_iso_speed_ratings():
|
||||
data = {'ISOSpeedRatings': ()}
|
||||
simple = get_exif_tags(data)
|
||||
assert 'iso' not in simple
|
||||
|
||||
data = {'ISOSpeedRatings': None}
|
||||
simple = get_exif_tags(data)
|
||||
assert 'iso' not in simple
|
||||
|
||||
data = {'ISOSpeedRatings': 125}
|
||||
simple = get_exif_tags(data)
|
||||
assert 'iso' in simple
|
||||
|
||||
|
||||
def test_null_exposure_time():
|
||||
data = {'ExposureTime': (0, 0)}
|
||||
simple = get_exif_tags(data)
|
||||
|
||||
Reference in New Issue
Block a user