Skip to content

Commit

Permalink
removed checksum of jpeg files
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisBarker-NOAA committed Nov 8, 2016
1 parent a680c48 commit 4776727
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions py_gd/test/test_gd.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
import numpy as np
import py_gd


def outfile(file_name):
# just to make it a little easier to type..
output_dir = "./test_images_output"
if not os.path.exists(output_dir):
os.mkdir(output_dir)
return os.path.join(output_dir, file_name)
# just to make it a little easier to type..
output_dir = "./test_images_output"
if not os.path.exists(output_dir):
os.mkdir(output_dir)
return os.path.join(output_dir, file_name)


def check_file(name):
"""
Expand Down Expand Up @@ -255,20 +257,21 @@ def test_add_colors_max():
def test_save_image(filetype):
img = py_gd.Image(400, 300)

img.draw_line((0, 0), (399, 299), 'white', line_width=4)
img.draw_line((0, 0), (399, 299), 'white', line_width=4)
img.draw_line((0, 299), (399, 0), 'green', line_width=4)

fname = "test_image_save." + filetype
img.save(outfile(fname), filetype)

assert check_file(fname)
if filetype is not "jpg": # jpeg is lossy and thus inconsistent
assert check_file(fname)

with pytest.raises(ValueError):
img.save(outfile("test_image1.something"), "random_string")


def test_clear():
img = py_gd.Image(100,200)
img = py_gd.Image(100, 200)

# just to put something in there to clear.
img.draw_rectangle((-10, -10), (50, 100), fill_color='red')
Expand Down

0 comments on commit 4776727

Please sign in to comment.