Beispiel #1
0
def test_darken_pixels_calls_library():
    with mock.patch("img_utils.img_utils._darken_pixels") as mock_fun:
        img_utils.darken_pixels("foo", "bar", 0, 1)

    mock_fun.assert_called_with("foo", "bar", 0, 1)
Beispiel #2
0
def test_darken_pixels_file_not_found():
    with pytest.raises(exceptions.FileNotFoundException):
        darken_pixels("/non/existant/file.jpg", "/out.jpg", 0, 0)
Beispiel #3
0
def test_darken_pixels_invalid_file_type():
    with pytest.raises(exceptions.UnsupportedFormatException):
        darken_pixels("./tests/assets/bin", "/out.jpg", 0, 0)
Beispiel #4
0
def test_darken_pixels_invalid_u8_arguments():
    out = tempfile.NamedTemporaryFile(suffix=".jpg").name

    darken_pixels("./tests/assets/test-small.jpg", out, -10, 25)
Beispiel #5
0
 def rust_darken(in_file: str, out_file: str):
     img_utils.darken_pixels(in_file, out_file, AMOUNT, CUTOFF)