Skip to content

Commit f038eb7

Browse files
committed
Test functions
1 parent c214086 commit f038eb7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_deepstack.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,26 @@
3333
}
3434

3535
MOCK_PREDICTIONS = MOCK_RESPONSE["predictions"]
36+
MOCK_CONFIDENCES = [0.6998661, 0.7996547]
37+
CONFIDENCE_THRESHOLD = 0.7
3638

3739

3840
def test_get_object_labels():
41+
"""Cant always be sure order of returned list items."""
3942
object_labels = ds.get_object_labels(MOCK_PREDICTIONS)
43+
assert type(object_labels) is list
4044
assert "dog" in object_labels
4145
assert "person" in object_labels
4246
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

0 commit comments

Comments
 (0)