コード例 #1
0
def test_image_check_valid_color_borders_crop():
    check_valid(
        ExampleImage(123, True).add_border(10, 0, 20, 30, (100, 100, 0)),
        ExampleImage(123,
                     True).add_border(10, 0, 20, 30, (100, 100, 0)).add_border(
                         20, 10, 0, 30,
                         (0, 200, 100)).border_count_to_check(1))
コード例 #2
0
def test_image_check_valid_color_borders():
    check_valid(
        ExampleImage(123, True).add_border(10, 0, 20, 30,
                                           (100, 100, 0)).add_border(
                                               20, 10, 0, 30, (0, 200, 100)),
        ExampleImage(123, True).add_border(10, 0, 20, 30,
                                           (100, 100, 0)).add_border(
                                               20, 10, 0, 30, (0, 200, 100)))
コード例 #3
0
def test_image_check_invalid_file(tmpdir):
    image1 = ExampleImage(123, True)
    image2 = ExampleImage(321, True)
    filename = str(tmpdir.join("image.jpg"))
    image1.save(filename)
    assert not image2.valid(filename)
コード例 #4
0
def test_image_check_valid_rotation():
    check_valid(ExampleImage(1, True),
                ExampleImage(512, True).set_validation_rotation(180))
コード例 #5
0
def test_image_check_invalid_mixed():
    check_invalid(ExampleImage(123, True), ExampleImage(123, False))
    check_invalid(ExampleImage(123, False), ExampleImage(123, True))
コード例 #6
0
def test_image_check_invalid_bw_borders_crop():
    check_invalid(
        ExampleImage(123, False).add_border(10, 0, 20, 30, 100),
        ExampleImage(123, False).add_border(10, 0, 20, 30,
                                            100).border_count_to_check(0))
コード例 #7
0
def test_image_check_invalid_bw_borders():
    check_invalid(
        ExampleImage(123, False).add_border(10, 20, 30, 40, 100),
        ExampleImage(123, False).add_border(10, 0, 0, 40, 100))
コード例 #8
0
def test_image_check_invalid_bw():
    check_invalid(ExampleImage(1023, False), ExampleImage(1022, False))
    check_invalid(ExampleImage(1023, False), ExampleImage(511, False))
コード例 #9
0
def test_image_check_invalid_color():
    check_invalid(ExampleImage(1023, True), ExampleImage(1022, True))
    check_invalid(ExampleImage(1023, True), ExampleImage(511, True))
コード例 #10
0
def test_image_check_valid_bw():
    check_valid(ExampleImage(123, False), ExampleImage(123, False))
コード例 #11
0
def test_image_check_valid_color():
    check_valid(ExampleImage(123, True), ExampleImage(123, True))
コード例 #12
0
def test_image_check_invalid_file(tmpdir):
    image1 = ExampleImage(123, True)
    image2 = ExampleImage(321, True)
    filename = str(tmpdir.join("image.jpg"))
    image1.save(filename)
    assert not image2.valid(filename)