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)
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)
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)
def test_process_request_works(): json = r"""{ "images": { "tests/images/lama.jpg": null }, "filters": { "framed": { } } } """ assert qualipy.process_request(json)[TEST_IMG]
def test_process_request_fails_for_no_filters(): json = r"""{ "images": { "tests/images/lama.jpg": null } }""" with pytest.raises(ValueError): qualipy.process_request(json)
def test_process_request_fails_for_no_images(): json = r"""{ "filters": { "framed": { } } }""" with pytest.raises(ValueError): qualipy.process_request(json)
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]
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
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]
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