Пример #1
0
def test_process_request_fails_for_invalid_parameters():
    json = r"""{ "images": { "tests/images/framed.jpg": null },
                 "filters": { "framed": { "x": 1.01 } } }
            """

    with pytest.raises(ValueError):
        qualipy.process_request(json)
Пример #2
0
def test_process_request_fials_for_invalid_ROI():
    json = r"""{ "images": { "tests/images/lama.jpg": [0, 0, 200] },
                 "filters": { "framed": { } } }
            """

    with pytest.raises(ValueError):
        qualipy.process_request(json)
Пример #3
0
def test_process_request_fails_for_invalid_json():
    json = r"""{ "images":  "tests/images/lama.jpg": null },
                 "filters": { "framed": { } } }
            """

    with pytest.raises(ValueError):
        qualipy.process_request(json)
Пример #4
0
def test_process_request_works():
    json = r"""{ "images": { "tests/images/lama.jpg": null },
                 "filters": { "framed": { } } }
            """
    assert qualipy.process_request(json)[TEST_IMG]
Пример #5
0
def test_process_request_fails_for_no_filters():
    json = r"""{ "images": { "tests/images/lama.jpg": null } }"""

    with pytest.raises(ValueError):
        qualipy.process_request(json)
Пример #6
0
def test_process_request_fails_for_no_images():
    json = r"""{ "filters": { "framed": { } } }"""

    with pytest.raises(ValueError):
        qualipy.process_request(json)
Пример #7
0
def test_process_request_works_for_filter_parameters():
    json = r"""{ "images": { "tests/images/framed.jpg": null },
                 "filters": { "framed": { "threshold": 1.01,
                                          "invert_threshold": true } } }
            """
    assert not qualipy.process_request(json)[TEST_IMG2]
Пример #8
0
def test_process_request_works_for_parameters():
    json = r"""{ "images": { "tests/images/lama.jpg": null },
                 "filters": { "framed": { } },
                 "combine_results": false }
            """
    assert type(qualipy.process_request(json)[TEST_IMG]) != bool
Пример #9
0
def test_process_request_works_for_ROI():
    json = r"""{ "images": { "tests/images/lama.jpg": [0, 0, 200, 200] },
                 "filters": { "framed": { } } }
            """
    assert qualipy.process_request(json)[TEST_IMG]
Пример #10
0
def test_process_request_works_for_multiple_images():
    json = r"""{ "images": { "tests/images/lama.jpg": null,
                             "tests/images/framed.jpg": null },
                 "filters": { "framed": { } } }
            """
    assert len(qualipy.process_request(json)) == 2