Пример #1
0
def test_zero_intensity():
    vibrance("pixfixPy/test/test_img/vibrance/test_img1.png", 0,
             "pixfixPy/test/test_img/vibrance/vibrance.png")
    output_img = skimage.io.imread(
        "pixfixPy/test/test_img/vibrance/vibrance.png")[:, :, :3]
    assert np.array_equal(
        output_img, test_img1), "Images should be indentical with 0 intensity."
Пример #2
0
def test_correct_vibrance():
    vibrance("pixfixPy/test/test_img/vibrance/test_img1.png", 10,
             "pixfixPy/test/test_img/vibrance/expected_img1.png")
    output_img = skimage.io.imread(
        "pixfixPy/test/test_img/vibrance/testImg1_output.png")[:, :, :3]
    assert np.array_equal(
        output_img, expected_img1
    ), "The image returned should be identical with 10 intensity."
Пример #3
0
def test_output_path_valid():
    with pytest.raises(FileNotFoundError):
        vibrance("pixfixPy/test/test_img/vibrance/test_img1.png", 5,
                 "@( * O * )@")
Пример #4
0
def test_input_exist():
    with pytest.raises(FileExistsError):
        vibrance("pixfixPy/test/test_img/ffxiv/namazu.png", 5,
                 "pixfixPy/test/test_img/vibrance/vibrance.png")
Пример #5
0
def test_output_nonimage():
    with pytest.raises(OSError):
        vibrance("pixfixPy/test/test_img/vibrance/test_img1.png", 5,
                 "pixfixPy/test/test_img/vibrance/vibrance.pdf")
Пример #6
0
def test_valid_intensity():
    with pytest.raises(AttributeError):
        vibrance("pixfixPy/test/test_img/vibrance/test_img1.png", -10.5,
                 "pixfixPy/test/test_img/vibrance/vibrance.png")
Пример #7
0
def test_input_string():
    with pytest.raises(AttributeError):
        vibrance(888, 5, "pixfixPy/test/test_img/vibrance/vibrance.png")