コード例 #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)
コード例 #2
0
ファイル: test_errors.py プロジェクト: ikornaselur/img-utils
def test_darken_pixels_file_not_found():
    with pytest.raises(exceptions.FileNotFoundException):
        darken_pixels("/non/existant/file.jpg", "/out.jpg", 0, 0)
コード例 #3
0
ファイル: test_errors.py プロジェクト: ikornaselur/img-utils
def test_darken_pixels_invalid_file_type():
    with pytest.raises(exceptions.UnsupportedFormatException):
        darken_pixels("./tests/assets/bin", "/out.jpg", 0, 0)
コード例 #4
0
ファイル: test_errors.py プロジェクト: ikornaselur/img-utils
def test_darken_pixels_invalid_u8_arguments():
    out = tempfile.NamedTemporaryFile(suffix=".jpg").name

    darken_pixels("./tests/assets/test-small.jpg", out, -10, 25)
コード例 #5
0
ファイル: bench.py プロジェクト: ikornaselur/img-utils
 def rust_darken(in_file: str, out_file: str):
     img_utils.darken_pixels(in_file, out_file, AMOUNT, CUTOFF)