Ejemplo n.º 1
0
def test_create_new_image():
    input = np.zeros((100, 100, 3), dtype=np.uint8)
    input[:25,:25] = 1
    input[25:50,25:50] = 2
    expected = input[20:30,20:30]
    resault = np.array(create_new_image(input, 4, 4, 10, 10, 5, 5))
    assert(np.array_equal(expected, resault))
Ejemplo n.º 2
0
def test_negative_args():
    input = np.zeros((100, 100, 3), dtype=np.uint8)
    with pytest.raises(ValueError) as e_info:
        create_new_image(input, -4, 4, 4, 4, 5, 5)
        create_new_image(input, 4, -4, 4, 4, 5, 5)
        create_new_image(input, 4, 4, -4, 4, 5, 5)
        create_new_image(input, 4, 4, 4, -4, 5, 5)
        create_new_image(input, 4, 4, 4, 4, -5, 5)
        create_new_image(input, 4, 4, 4, 4, 5, -5)
Ejemplo n.º 3
0
def test_image_type(tmpdir):
    input = Image.fromarray(np.zeros((100, 100, 3), dtype=np.uint8))
    with pytest.raises(TypeError) as e_info:
        create_new_image(input)
Ejemplo n.º 4
0
def test_to_big_pocket_both():
    input = np.zeros((100, 100, 3), dtype=np.uint8)
    with pytest.raises(ValueError) as e_info:
        create_new_image(input, 4, 4, 4, 4, 5, 5)