示例#1
0
def test_correct_sharpen():
    sharpen("picfixPy/test/test_img/sharpen/test_img1.png", 
             5,
             False,
             "picfixPy/test/test_img/sharpen/expected_img1.png")
    output_img = skimage.io.imread("picfixPy/test/test_img/sharpen/expected_img1.png")[:, :, :3]
    assert np.array_equal(output_img, expected_img1), "The image should be correctly sharpened with intensity of 5."
示例#2
0
def test_display_image():
    try:
        sharpen("picfixPy/test/test_img/sharpen/test_img1.png", 
                 5, 
                 True)
    except Exception: # pragma: no cover
        raise pytest.fail("Cannot display image, something went wrong.")
示例#3
0
def test_zero_intensity():
    sharpen("picfixPy/test/test_img/sharpen/test_img1.png", 
             0,
             False,
             "picfixPy/test/test_img/sharpen/sharpen.png")
    output_img = skimage.io.imread("picfixPy/test/test_img/sharpen/sharpen.png")[:, :, :3]
    assert np.array_equal(output_img, test_img1), "Images should be indentical with 0 intensity."
示例#4
0
def test_output_path_valid():
    with pytest.raises(FileNotFoundError):
        sharpen("picfixPy/test/test_img/sharpen/test_img1.png", 
                5, 
                False,
                "beasttribe/namazu/dailies.png")    
示例#5
0
def test_output_nonimage():
    with pytest.raises(ValueError):
        sharpen("picfixPy/test/test_img/sharpen/test_img1.png", 
                 5, 
                 False,
                 "picfixPy/test/test_img/sharpen/test_img2.java") 
示例#6
0
def test_input_nonimage():
    with pytest.raises(OSError):
        sharpen("picfixPy/test/test_img/sharpen/test_img1.java", 
                5, 
                False,
                "picfixPy/test/test_img/sharpen/sharpen.png")
示例#7
0
def test_input_exist():
    with pytest.raises(FileNotFoundError):
        sharpen("picfixPy/test/test_img/ffxiv/namazu.png", 
                5,
                False, 
                "picfixPy/test/test_img/sharpen/sharpen.png")
示例#8
0
def test_valid_intensity():
    with pytest.raises(ValueError):
        sharpen("picfixPy/test/test_img/sharpen/test_img1.png", 
                -10.5, 
                False,
                "picfixPy/test/test_img/sharpen/sharpen.png")
示例#9
0
def test_input_string():
    with pytest.raises(AttributeError):
        sharpen(888, 5, False, "picfixPy/test/test_img/sharpen/sharpen.png")