Skip to content

Commit 1f78fce

Browse files
committed
Added tests
1 parent 2f4bb7d commit 1f78fce

File tree

7 files changed

+689
-2
lines changed

7 files changed

+689
-2
lines changed

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
minversion = 3.0
33
log_cli=true
44
python_files = test_*.py
5-
addopts = -n auto --dist=loadscope
5+
;addopts = -n auto --dist=loadscope

src/superannotate/lib/core/data_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def convert_timestamp(timestamp):
298298
end_time = safe_time(convert_timestamp(parameter["end"]))
299299

300300
for timestamp_data in parameter["timestamps"]:
301-
timestamp = safe_time(
301+
timestamp = safeg_time(
302302
convert_timestamp(timestamp_data["timestamp"])
303303
)
304304
editor_instance["timeline"][timestamp] = {}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[
2+
{
3+
"id": 857627,
4+
"project_id": 150845,
5+
"name": "vid",
6+
"color": "#0fc1c9",
7+
"count": 0,
8+
"createdAt": "2021-10-01T13:03:51.000Z",
9+
"updatedAt": "2021-10-01T13:03:51.000Z",
10+
"attribute_groups": [
11+
{
12+
"id": 337487,
13+
"class_id": 857627,
14+
"name": "attr g",
15+
"is_multiselect": 0,
16+
"createdAt": "2021-10-04T07:01:29.000Z",
17+
"updatedAt": "2021-10-04T07:01:29.000Z",
18+
"attributes": [
19+
{
20+
"id": 1174520,
21+
"group_id": 337487,
22+
"project_id": 150845,
23+
"name": "attr",
24+
"count": 0,
25+
"createdAt": "2021-10-04T07:01:31.000Z",
26+
"updatedAt": "2021-10-04T07:01:31.000Z"
27+
}
28+
]
29+
}
30+
]
31+
}
32+
]
Lines changed: 299 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,299 @@
1+
{
2+
"metadata": {
3+
"name": "video.mp4",
4+
"width": 480,
5+
"height": 270,
6+
"status": "NotStarted",
7+
"url": "https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4",
8+
"duration": 30526667,
9+
"projectId": 152038,
10+
"error": null,
11+
"annotatorEmail": null,
12+
"qaEmail": null
13+
},
14+
"instances": [
15+
{
16+
"meta": {
17+
"type": "bbox",
18+
"classId": 859496,
19+
"className": "vid",
20+
"pointLabels": {
21+
"3": "point label bro"
22+
},
23+
"start": 0,
24+
"end": 30526667
25+
},
26+
"parameters": [
27+
{
28+
"start": 0,
29+
"end": 30526667,
30+
"timestamps": [
31+
{
32+
"points": {
33+
"x1": 223.32,
34+
"y1": 78.45,
35+
"x2": 312.31,
36+
"y2": 176.66
37+
},
38+
"timestamp": 0,
39+
"attributes": []
40+
},
41+
{
42+
"points": {
43+
"x1": 182.08,
44+
"y1": 33.18,
45+
"x2": 283.45,
46+
"y2": 131.39
47+
},
48+
"timestamp": 17271058,
49+
"attributes": [
50+
{
51+
"id": 1175876,
52+
"groupId": 338357,
53+
"name": "attr",
54+
"groupName": "attr g"
55+
}
56+
]
57+
},
58+
{
59+
"points": {
60+
"x1": 182.32,
61+
"y1": 36.33,
62+
"x2": 284.01,
63+
"y2": 134.54
64+
},
65+
"timestamp": 18271058,
66+
"attributes": [
67+
{
68+
"id": 1175876,
69+
"groupId": 338357,
70+
"name": "attr",
71+
"groupName": "attr g"
72+
}
73+
]
74+
},
75+
{
76+
"points": {
77+
"x1": 181.49,
78+
"y1": 45.09,
79+
"x2": 283.18,
80+
"y2": 143.3
81+
},
82+
"timestamp": 19271058,
83+
"attributes": [
84+
{
85+
"id": 1175876,
86+
"groupId": 338357,
87+
"name": "attr",
88+
"groupName": "attr g"
89+
}
90+
]
91+
},
92+
{
93+
"points": {
94+
"x1": 181.9,
95+
"y1": 48.35,
96+
"x2": 283.59,
97+
"y2": 146.56
98+
},
99+
"timestamp": 19725864,
100+
"attributes": [
101+
{
102+
"id": 1175876,
103+
"groupId": 338357,
104+
"name": "attr",
105+
"groupName": "attr g"
106+
}
107+
]
108+
},
109+
{
110+
"points": {
111+
"x1": 181.49,
112+
"y1": 52.46,
113+
"x2": 283.18,
114+
"y2": 150.67
115+
},
116+
"timestamp": 20271058,
117+
"attributes": [
118+
{
119+
"id": 1175876,
120+
"groupId": 338357,
121+
"name": "attr",
122+
"groupName": "attr g"
123+
}
124+
]
125+
},
126+
{
127+
"points": {
128+
"x1": 181.49,
129+
"y1": 63.7,
130+
"x2": 283.18,
131+
"y2": 161.91
132+
},
133+
"timestamp": 21271058,
134+
"attributes": [
135+
{
136+
"id": 1175876,
137+
"groupId": 338357,
138+
"name": "attr",
139+
"groupName": "attr g"
140+
}
141+
]
142+
},
143+
{
144+
"points": {
145+
"x1": 182.07,
146+
"y1": 72.76,
147+
"x2": 283.76,
148+
"y2": 170.97
149+
},
150+
"timestamp": 22271058,
151+
"attributes": [
152+
{
153+
"id": 1175876,
154+
"groupId": 338357,
155+
"name": "attr",
156+
"groupName": "attr g"
157+
}
158+
]
159+
},
160+
{
161+
"points": {
162+
"x1": 182.07,
163+
"y1": 81.51,
164+
"x2": 283.76,
165+
"y2": 179.72
166+
},
167+
"timestamp": 23271058,
168+
"attributes": [
169+
{
170+
"id": 1175876,
171+
"groupId": 338357,
172+
"name": "attr",
173+
"groupName": "attr g"
174+
}
175+
]
176+
},
177+
{
178+
"points": {
179+
"x1": 182.42,
180+
"y1": 97.19,
181+
"x2": 284.11,
182+
"y2": 195.4
183+
},
184+
"timestamp": 24271058,
185+
"attributes": [
186+
{
187+
"id": 1175876,
188+
"groupId": 338357,
189+
"name": "attr",
190+
"groupName": "attr g"
191+
}
192+
]
193+
},
194+
{
195+
"points": {
196+
"x1": 182.42,
197+
"y1": 97.19,
198+
"x2": 284.11,
199+
"y2": 195.4
200+
},
201+
"timestamp": 30526667,
202+
"attributes": [
203+
{
204+
"id": 1175876,
205+
"groupId": 338357,
206+
"name": "attr",
207+
"groupName": "attr g"
208+
}
209+
]
210+
}
211+
]
212+
}
213+
]
214+
},
215+
{
216+
"meta": {
217+
"type": "bbox",
218+
"classId": 859496,
219+
"className": "vid",
220+
"start": 29713736,
221+
"end": 30526667
222+
},
223+
"parameters": [
224+
{
225+
"start": 29713736,
226+
"end": 30526667,
227+
"timestamps": [
228+
{
229+
"points": {
230+
"x1": 132.82,
231+
"y1": 129.12,
232+
"x2": 175.16,
233+
"y2": 188
234+
},
235+
"timestamp": 29713736,
236+
"attributes": []
237+
},
238+
{
239+
"points": {
240+
"x1": 132.82,
241+
"y1": 129.12,
242+
"x2": 175.16,
243+
"y2": 188
244+
},
245+
"timestamp": 30526667,
246+
"attributes": []
247+
}
248+
]
249+
}
250+
]
251+
},
252+
{
253+
"meta": {
254+
"type": "event",
255+
"classId": 859496,
256+
"className": "vid",
257+
"start": 5528212,
258+
"end": 7083022
259+
},
260+
"parameters": [
261+
{
262+
"start": 5528212,
263+
"end": 7083022,
264+
"timestamps": [
265+
{
266+
"timestamp": 5528212,
267+
"attributes": []
268+
},
269+
{
270+
"timestamp": 6702957,
271+
"attributes": [
272+
{
273+
"id": 1175876,
274+
"groupId": 338357,
275+
"name": "attr",
276+
"groupName": "attr g"
277+
}
278+
]
279+
},
280+
{
281+
"timestamp": 7083022,
282+
"attributes": [
283+
{
284+
"id": 1175876,
285+
"groupId": 338357,
286+
"name": "attr",
287+
"groupName": "attr g"
288+
}
289+
]
290+
}
291+
]
292+
}
293+
]
294+
}
295+
],
296+
"tags": [
297+
"some tag"
298+
]
299+
}

0 commit comments

Comments
 (0)