Skip to content

Commit 23a41dc

Browse files
committed
add test
1 parent 90b6b30 commit 23a41dc

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@
33

44
# deepstack-python
55
Unofficial python API for DeepStack. Provides class for making requests to the object detection endpoint, and functions for processing the result. See the `usage.ipynb` notebook for usage.
6+
7+
## Development
8+
* Use `venv`
9+
* `pip install -r requirements-dev.txt`
10+
* Run tests with `venv/bin/pytest tests/*`

requirements-dev.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pytest
2+
black

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
requests
2+
pillow

tests/test_deepstack.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,31 @@
1-
# Placeholder
1+
# Placeholder
2+
3+
import deepstack.core as ds
4+
5+
MOCK_RESPONSE ={'success': True,
6+
'predictions': [{'confidence': 0.6998661,
7+
'label': 'person',
8+
'y_min': 0,
9+
'x_min': 258,
10+
'y_max': 676,
11+
'x_max': 485},
12+
{'confidence': 0.7996547,
13+
'label': 'person',
14+
'y_min': 0,
15+
'x_min': 405,
16+
'y_max': 652,
17+
'x_max': 639},
18+
{'confidence': 0.59745613,
19+
'label': 'dog',
20+
'y_min': 311,
21+
'x_min': 624,
22+
'y_max': 591,
23+
'x_max': 825}]}
24+
25+
MOCK_PREDICTIONS = MOCK_RESPONSE['predictions']
26+
27+
def test_get_object_labels():
28+
object_labels = ds.get_object_labels(MOCK_PREDICTIONS)
29+
assert 'dog' in object_labels
30+
assert 'person' in object_labels
31+
assert len(object_labels) == 2

0 commit comments

Comments
 (0)