File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change
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 ()
You can’t perform that action at this time.
0 commit comments