def test_wrong_parameters_6(): try: image = numpy.zeros((25, 25, 3)) get_mean_image(image) except Exception, e: assert e.message == 'images is not a list' assert type(e) == TypeError
def test_wrong_parameters_7(): images = list() images.append(numpy.ones((25, 25, 3))) images.append(numpy.zeros((15, 15, 3))) try: get_mean_image(images) except Exception, e: assert e.message == 'Shape of ndarray image in list is different' assert type(e) == ValueError
def test_simply_working_1(): images = list() for i in range(10): images.append(numpy.zeros((25, 25, 3))) image = get_mean_image(images) assert numpy.count_nonzero(image) == 0 assert image.ndim == 3 assert image.shape == (25, 25, 3)
def test_simply_working_3(): images = list() for i in range(0, 1): images.append(numpy.ones((25, 25, 3))) for i in range(1, 10): images.append(numpy.zeros((25, 25, 3))) image = get_mean_image(images) assert (image == 0.1).all() assert image.ndim == 3 assert image.shape == (25, 25, 3)
def test_simply_working_1(): images = list() img_1 = numpy.ones((25, 25, 3), numpy.uint8) images.append(img_1) images.append(numpy.zeros((25, 25, 3), numpy.uint8)) mean_image = get_mean_image(images) image = mean_shift_binarization(img_1, mean_image) assert numpy.count_nonzero(image) == 0 assert mean_image.shape == (25, 25, 3) assert mean_image.ndim == 3 assert numpy.count_nonzero(mean_image) == 0
def test_wrong_parameters_4(): try: get_mean_image([[]]) except Exception, e: assert e.message == 'image in list images is not a ndarray' assert type(e) == TypeError
def test_wrong_parameters_2(): try: get_mean_image(list()) except Exception, e: assert e.message == 'images is empty' assert type(e) == ValueError
def test_wrong_parameters_1(): try: get_mean_image(None) except Exception, e: assert e.message == 'images is not a list' assert type(e) == TypeError