Beispiel #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."
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."
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."
Beispiel #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."
Beispiel #5
0
def test_nonexistent_output_path():
    with pytest.raises(FileNotFoundError):
        greyscale("instapy/test/test_img/greyscale/test_img1.png",
                  "./123/456.png")
Beispiel #6
0
def test_non_string_output():
    with pytest.raises(AttributeError):
        greyscale("instapy/test/test_img/greyscale/test_img1.png", 123)
Beispiel #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")
Beispiel #8
0
def test_non_string_input():
    with pytest.raises(AttributeError):
        greyscale(123, "instapy/test/test_img/greyscale/test_img1_gs.png")
def test_non_string_output():
    with pytest.raises(TypeError):
        greyscale("instapy/test/test_img/greyscale/test_img1.jpg", 123)
Beispiel #10
0
def test_nonexistent_input_path():
    with pytest.raises(FileNotFoundError):
        greyscale("./123/456.jpg",
                  "instapy/test/test_img/greyscale/test_img1_gs.jpg")