Skip to content

Commit

Permalink
Merge pull request #51 from imageio/style
Browse files Browse the repository at this point in the history
induce style error to test detection
  • Loading branch information
almarklein committed Dec 15, 2014
2 parents fbba7c3 + 4f0b2ae commit daaacec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ script:
- python -c "import sys; print(sys.version, '\n', sys.prefix)";
# Run unit tests or style test
- if [ "${TRAVIS_PYTHON_VERSION}" == "3.3" ]; then
python make test style;
echo "Size difference ${SIZE_DIFF} kB";
test ${SIZE_DIFF} -lt 100;
fi;
- if [ "${TRAVIS_PYTHON_VERSION}" == "3.3" ]; then
python make test style;
elif [ "${TRAVIS_PYTHON_VERSION}" == "2.7" ]; then
python make test installed;
else
Expand Down
12 changes: 6 additions & 6 deletions imageio/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ def image_as_uint8(im):
# Now make float copy before we scale
im = im.astype('float32')
# Scale the values between 0 and 255
if mi:
im -= mi
if ma != 255:
im *= 255.0 / (ma - mi)
# Done
assert np.nanmax(im) < 256
if np.isfinite(mi) and np.isfinite(ma):
if mi:
im -= mi
if ma != 255:
im *= 255.0 / (ma - mi)
assert np.nanmax(im) < 256
return im.astype(np.uint8)


Expand Down
2 changes: 1 addition & 1 deletion tests/test_swf.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def test_types():

for dtype in [np.uint8, np.float32]:
for shape in [(100, 100), (100, 100, 1), (100, 100, 3)]:
im1 = np.empty(shape, dtype)
im1 = np.empty(shape, dtype) # empty is nice for testing nan
imageio.mimsave(fname2, [im1], 'swf')
im2 = imageio.mimread(fname2, 'swf')[0]
assert im2.shape == (100, 100, 4)
Expand Down

0 comments on commit daaacec

Please sign in to comment.