Ejemplo n.º 1
0
def test_greyscale1():
    greyscale("instapy/test/test_img/greyscale/test_img1.png",
              "instapy/test/test_img/greyscale/test_img1_gs.png")
    output = skimage.io.imread(
        "instapy/test/test_img/greyscale/test_img1_gs.png")[:, :, :3]
    assert np.array_equal(
        output, test_img1_gs), "The greyscale function does not work properly."
Ejemplo n.º 2
0
def test_greyscale2():
    greyscale("instapy/test/test_img/greyscale/test_img2.jpg",
              "instapy/test/test_img/greyscale/test_img2_gs.jpg")
    output = plt.imread(
        "instapy/test/test_img/greyscale/test_img2_gs.jpg")[:, :, :3]
    assert (output == test_img2).all(
    ), "The greyscale function should not change a greyscale image."
Ejemplo n.º 3
0
def test_greyscale1():
    greyscale("instapy/test/test_img/greyscale/test_img1.jpg",
              "instapy/test/test_img/greyscale/test_img1_gs.jpg")
    output = plt.imread(
        "instapy/test/test_img/greyscale/test_img1_gs.jpg")[:, :, :3]
    assert (output == test_img1_gs
            ).all(), "The greyscale function does not work properly."
Ejemplo n.º 4
0
def test_greyscale2():
    greyscale("instapy/test/test_img/greyscale/test_img2.png",
              "instapy/test/test_img/greyscale/test_img2_gs.png")
    output = skimage.io.imread(
        "instapy/test/test_img/greyscale/test_img2_gs.png")[:, :, :3]
    assert np.array_equal(
        output, test_img2
    ), "The greyscale function should not change a greyscale image."
Ejemplo n.º 5
0
def test_nonexistent_output_path():
    with pytest.raises(FileNotFoundError):
        greyscale("instapy/test/test_img/greyscale/test_img1.png",
                  "./123/456.png")
Ejemplo n.º 6
0
def test_non_string_output():
    with pytest.raises(AttributeError):
        greyscale("instapy/test/test_img/greyscale/test_img1.png", 123)
Ejemplo n.º 7
0
def test_non_image_input_file():
    with pytest.raises(OSError):
        greyscale("instapy/test/test_img/greyscale/test.pdf",
                  "instapy/test/test_img/greyscale/test_img1_gs.png")
Ejemplo n.º 8
0
def test_non_string_input():
    with pytest.raises(AttributeError):
        greyscale(123, "instapy/test/test_img/greyscale/test_img1_gs.png")
Ejemplo n.º 9
0
def test_non_string_output():
    with pytest.raises(TypeError):
        greyscale("instapy/test/test_img/greyscale/test_img1.jpg", 123)
Ejemplo n.º 10
0
def test_nonexistent_input_path():
    with pytest.raises(FileNotFoundError):
        greyscale("./123/456.jpg",
                  "instapy/test/test_img/greyscale/test_img1_gs.jpg")