Example #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)
Example #2
0
def test_darken_pixels_file_not_found():
    with pytest.raises(exceptions.FileNotFoundException):
        darken_pixels("/non/existant/file.jpg", "/out.jpg", 0, 0)
Example #3
0
def test_darken_pixels_invalid_file_type():
    with pytest.raises(exceptions.UnsupportedFormatException):
        darken_pixels("./tests/assets/bin", "/out.jpg", 0, 0)
Example #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)
Example #5
0
 def rust_darken(in_file: str, out_file: str):
     img_utils.darken_pixels(in_file, out_file, AMOUNT, CUTOFF)