Merge branch 'pr/187'
This commit is contained in:
@@ -36,6 +36,7 @@ import PIL
|
||||
import pilkit.processors
|
||||
import sys
|
||||
import warnings
|
||||
import fractions
|
||||
|
||||
from copy import deepcopy
|
||||
from datetime import datetime
|
||||
@@ -254,7 +255,8 @@ def get_exif_tags(data):
|
||||
exptime = data['ExposureTime']
|
||||
if isinstance(exptime, tuple):
|
||||
try:
|
||||
simple['exposure'] = exptime[0] / float(exptime[1])
|
||||
simple['exposure'] = str(fractions.Fraction(exptime[0],
|
||||
exptime[1]))
|
||||
except IndexError:
|
||||
# Pillow == 3.0
|
||||
simple['exposure'] = exptime[0]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import PIL
|
||||
import pytest
|
||||
|
||||
from sigal.settings import read_settings
|
||||
@@ -12,3 +13,7 @@ CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
|
||||
def settings():
|
||||
"""Read the sample config file."""
|
||||
return read_settings(os.path.join(CURRENT_DIR, 'sample', 'sigal.conf.py'))
|
||||
|
||||
|
||||
def pytest_report_header(config):
|
||||
return "project deps: Pillow-{}".format(PIL.PILLOW_VERSION)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# -*- coding:utf-8 -*-
|
||||
|
||||
import os
|
||||
import PIL
|
||||
import pytest
|
||||
from PIL import Image
|
||||
|
||||
@@ -104,7 +105,10 @@ def test_get_exif_tags():
|
||||
assert simple['iso'] == 50
|
||||
assert simple['Make'] == 'NIKON'
|
||||
assert simple['datetime'] == 'Sunday, 22. January 2006'
|
||||
assert simple['exposure'] == 0.00100603
|
||||
if PIL.PILLOW_VERSION == '3.0.0':
|
||||
assert simple['exposure'] == 0.00100603
|
||||
else:
|
||||
assert simple['exposure'] == '100603/100000000'
|
||||
|
||||
data = {'FNumber': [1, 0], 'FocalLength': [1, 0], 'ExposureTime': 10}
|
||||
simple = get_exif_tags(data)
|
||||
@@ -142,7 +146,8 @@ def test_exif_copy(tmpdir):
|
||||
assert not simple
|
||||
|
||||
|
||||
@pytest.mark.xfail
|
||||
@pytest.mark.xfail(PIL.PILLOW_VERSION == '3.0.0',
|
||||
reason="Pillow 3.0.0 was broken")
|
||||
def test_exif_gps(tmpdir):
|
||||
"""Test reading out correct geo tags"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user