Skip to content

Commit 0f36931

Browse files
committed
test for wait behavior
1 parent d40f6cb commit 0f36931

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/unit/test_wait.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from groundlight import ExperimentalApi
2+
from unittest.mock import patch
3+
from model import ImageQuery, Source, BinaryClassificationResult, Label
4+
5+
6+
def test_wait_for_confident_result_returns_immediately_when_no_better_result_expected(
7+
gl_experimental: ExperimentalApi, initial_iq: ImageQuery
8+
):
9+
with patch.object(gl_experimental, "_wait_for_result") as mock_wait_for_result:
10+
# Should not wait if the image query is done processing
11+
initial_iq.done_processing = True
12+
gl_experimental.wait_for_confident_result(initial_iq)
13+
mock_wait_for_result.assert_not_called()
14+
15+
# Should not wait if the result is from the edge
16+
initial_iq.done_processing = False
17+
initial_iq.result = BinaryClassificationResult(source=Source.EDGE, label=Label.YES)
18+
gl_experimental.wait_for_confident_result(initial_iq)
19+
mock_wait_for_result.assert_not_called()

0 commit comments

Comments
 (0)