Skip to content

Commit ac41407

Browse files
Fix Integration Test (#78)
* fix an integration test * fix
1 parent 1fc8ec8 commit ac41407

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/integration/test_groundlight.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ def test_submit_image_query_jpeg_truncated(gl: Groundlight, detector: Detector):
200200
with pytest.raises(openapi_client.exceptions.ApiException) as exc_info:
201201
_image_query = gl.submit_image_query(detector=detector.id, image=jpeg_truncated)
202202
exc_value = exc_info.value
203+
print(f"exc_info = {exc_info}")
203204
assert is_user_error(exc_value.status)
204205

205206

@@ -391,10 +392,17 @@ def submit_noisy_image(image, label=None):
391392
time.sleep(wait_period)
392393
new_dog_query = submit_noisy_image(dog)
393394
new_cat_query = submit_noisy_image(cat)
394-
if new_cat_query.result.confidence < result_confidence or new_cat_query.result.label == "YES":
395+
new_cat_result_confidence = new_cat_query.result.confidence
396+
new_dog_result_confidence = new_dog_query.result.confidence
397+
398+
if (
399+
new_cat_result_confidence and new_cat_result_confidence < result_confidence
400+
) or new_cat_query.result.label == "YES":
395401
# If the new query is not confident enough, we'll try again
396402
continue
397-
elif new_dog_query.result.confidence < result_confidence or new_dog_query.result.label == "NO":
403+
elif (
404+
new_dog_result_confidence and new_dog_result_confidence < result_confidence
405+
) or new_dog_query.result.label == "NO":
398406
# If the new query is not confident enough, we'll try again
399407
continue
400408
else:

0 commit comments

Comments
 (0)