Example #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))
Example #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)))
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)
Example #4
0
def test_image_check_valid_rotation():
    check_valid(ExampleImage(1, True),
                ExampleImage(512, True).set_validation_rotation(180))
Example #5
0
def test_image_check_invalid_mixed():
    check_invalid(ExampleImage(123, True), ExampleImage(123, False))
    check_invalid(ExampleImage(123, False), ExampleImage(123, True))
Example #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))
Example #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))
Example #8
0
def test_image_check_invalid_bw():
    check_invalid(ExampleImage(1023, False), ExampleImage(1022, False))
    check_invalid(ExampleImage(1023, False), ExampleImage(511, False))
Example #9
0
def test_image_check_invalid_color():
    check_invalid(ExampleImage(1023, True), ExampleImage(1022, True))
    check_invalid(ExampleImage(1023, True), ExampleImage(511, True))
Example #10
0
def test_image_check_valid_bw():
    check_valid(ExampleImage(123, False), ExampleImage(123, False))
Example #11
0
def test_image_check_valid_color():
    check_valid(ExampleImage(123, True), ExampleImage(123, True))
Example #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)