File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 33
33
}
34
34
35
35
MOCK_PREDICTIONS = MOCK_RESPONSE ["predictions" ]
36
+ MOCK_CONFIDENCES = [0.6998661 , 0.7996547 ]
37
+ CONFIDENCE_THRESHOLD = 0.7
36
38
37
39
38
40
def test_get_object_labels ():
41
+ """Cant always be sure order of returned list items."""
39
42
object_labels = ds .get_object_labels (MOCK_PREDICTIONS )
43
+ assert type (object_labels ) is list
40
44
assert "dog" in object_labels
41
45
assert "person" in object_labels
42
46
assert len (object_labels ) == 2
47
+
48
+ def test_get_objects_summary ():
49
+ objects_summary = ds .get_objects_summary (MOCK_PREDICTIONS )
50
+ assert objects_summary == {'dog' : 1 , 'person' : 2 }
51
+
52
+ def test_get_label_confidences ():
53
+ label_confidences = ds .get_label_confidences (MOCK_PREDICTIONS , 'person' )
54
+ assert label_confidences == MOCK_CONFIDENCES
55
+
56
+
57
+ def test_get_confidences_above_threshold ():
58
+ assert len (ds .get_confidences_above_threshold (MOCK_CONFIDENCES , CONFIDENCE_THRESHOLD )) == 1
You can’t perform that action at this time.
0 commit comments