def test_rgb_im_None_and_image_not_none(): im = MyImage() im.image = Mock() assert_true(im._rgb_im is None) im.rgb_im assert_true(im._rgb_im is not None) assert_true(im.image.convert.called)
def test_rgb_im_not_none_and_image_none(): # this is the case where the image has been set previously # and has now been unset im = MyImage() im.image = Mock() im.rgb_im im.image=None with assert_raises(NoImageLoadedError): im.rgb_im
def test_rgb_im_not_none_and_image_not_none(): # this is the case where the image has been set previously # and has now been unset im = MyImage() im.image = Mock() im.rgb_im assert_equal(im.image.convert.call_count, 1) im.rgb_im # call count hasn't changed assert_equal(im.image.convert.call_count, 1)
def test_equal_different(): im = MyImage() im.load_from_file(IMAGE_FILE) im2 = MyImage() im2.load_from_file(IMAGE_FILE2) assert_false(are_images_equal_for_pixels(im,im2, PIXELS))
def test_equal_same(): im = MyImage() im.load_from_file(IMAGE_FILE) im2 = MyImage() im2.load_from_file(IMAGE_FILE) assert_true(are_images_equal_for_pixels(im,im2, PIXELS))
def test_load_from_file(): im = MyImage() im.load_from_file(IMAGE_FILE) assert_true(im.image is not None)