Ejemplo n.º 1
0
def test_padding():
    '''
    Check if the padding function could get the expected image
    '''
    padding("tests/images/sample.png", 20, "tests/images/samples_padding.jpg")
    output = skimage.io.imread("tests/images/samples_padding.jpg")
    test_output = skimage.io.imread("tests/images/samples_padding.jpg")
    assert np.array_equal(output, test_output), "The padding function does not work properly"
Ejemplo n.º 2
0
def test_nonexistent_output_path():
    '''
    Check unexpected padding function input for output
    '''
    with pytest.raises(FileNotFoundError):
        padding(
            "imageprocessor/tests/images/sample.png",
            "tests/123/s456.jpg"
        )
Ejemplo n.º 3
0
def test_nonexistent_input_path():
    '''
    Check unexpected padding function for input path
    '''
    with pytest.raises(FileNotFoundError):
        padding("./123/456.png", "tests/images/sample.png")
Ejemplo n.º 4
0
def test_non_string_output():
    '''
    Check unexpected padding function for output path format
    '''
    with pytest.raises(AttributeError):
        padding(325, 123)
Ejemplo n.º 5
0
def test_non_string_input():
    '''
    Check unexpected padding function input
    '''
    with pytest.raises(AttributeError):
        padding(123, 321)