@@ -219,110 +219,3 @@ def test_delete(module_project, predictions):
219219 bulk_import_request .delete ()
220220 all_import_requests = module_project .bulk_import_requests ()
221221 assert len (list (all_import_requests )) == 0
222-
223-
224- def _create_label (row_index , data_row_uids , label_name_ids = ['bbox' ]):
225- label_name = label_name_ids [row_index % len (label_name_ids )]
226- data_row_uid = data_row_uids [row_index % len (data_row_uids )]
227- return Label (data = GenericDataRowData (uid = data_row_uid ),
228- annotations = [
229- VideoObjectAnnotation (name = label_name ,
230- keyframe = True ,
231- frame = 4 ,
232- segment_index = 0 ,
233- value = Rectangle (
234- start = Point (x = 100 , y = 100 ),
235- end = Point (x = 105 , y = 105 ),
236- ))
237- ])
238-
239-
240- @pytest .mark .parametrize ("configured_project" , [MediaType .Video ], indirect = True )
241- @patch ('labelbox.schema.annotation_import.ANNOTATION_PER_LABEL_LIMIT' , 20 )
242- def test_below_annotation_limit_on_single_data_row (
243- client , configured_project , video_data , rand_gen ):
244- _ , data_row_uids = video_data
245- configured_project .create_batch (
246- rand_gen (str ),
247- data_row_uids , # sample of data row objects
248- 5 # priority between 1(Highest) - 5(lowest)
249- )
250- labels = [_create_label (index , data_row_uids ) for index in range (19 )]
251- import_annotations = MALPredictionImport .create_from_objects (
252- client = client ,
253- project_id = configured_project .uid ,
254- name = f"import { str (uuid .uuid4 ())} " ,
255- predictions = labels )
256- import_annotations .wait_until_done ()
257-
258- assert import_annotations .errors == []
259-
260-
261- @pytest .mark .parametrize ("configured_project" , [MediaType .Video ], indirect = True )
262- @patch ('labelbox.schema.annotation_import.ANNOTATION_PER_LABEL_LIMIT' , 20 )
263- def test_above_annotation_limit_on_single_label_on_single_data_row (
264- client , configured_project , video_data , rand_gen ):
265- _ , data_row_uids = video_data
266-
267- configured_project .create_batch (
268- rand_gen (str ),
269- data_row_uids , # sample of data row objects
270- 5 # priority between 1(Highest) - 5(lowest)
271- )
272- labels = [_create_label (index , data_row_uids ) for index in range (21 )]
273- with pytest .raises (ValueError ):
274- import_annotations = MALPredictionImport .create_from_objects (
275- client = client ,
276- project_id = configured_project .uid ,
277- name = f"import { str (uuid .uuid4 ())} " ,
278- predictions = labels )
279- import_annotations .wait_until_done ()
280-
281- @pytest .mark .parametrize ("configured_project" , [MediaType .Video ], indirect = True )
282- @patch ('labelbox.schema.annotation_import.ANNOTATION_PER_LABEL_LIMIT' , 20 )
283- def test_above_annotation_limit_divided_among_different_rows (
284- client , configured_project , video_data_100_rows ,
285- rand_gen ):
286- _ , data_row_uids = video_data_100_rows
287-
288- configured_project .create_batch (
289- rand_gen (str ),
290- data_row_uids , # sample of data row objects
291- 5 # priority between 1(Highest) - 5(lowest)
292- )
293- labels = [_create_label (index , data_row_uids ) for index in range (21 )]
294-
295- import_annotations = MALPredictionImport .create_from_objects (
296- client = client ,
297- project_id = configured_project .uid ,
298- name = f"import { str (uuid .uuid4 ())} " ,
299- predictions = labels )
300-
301- assert import_annotations .errors == []
302-
303-
304- @pytest .mark .parametrize ("configured_project" , [MediaType .Video ], indirect = True )
305- @patch ('labelbox.schema.annotation_import.ANNOTATION_PER_LABEL_LIMIT' , 20 )
306- def test_above_annotation_limit_divided_among_labels_on_one_row (
307- client , configured_project , video_data , rand_gen ):
308- _ , data_row_uids = video_data
309-
310- configured_project .create_batch (
311- rand_gen (str ),
312- data_row_uids , # sample of data row objects
313- 5 # priority between 1(Highest) - 5(lowest)
314- )
315- labels = [
316- _create_label (index ,
317- data_row_uids ,
318- label_name_ids = ['bbox' , 'bbox_tool_with_nested_text' ])
319- for index in range (21 )
320- ]
321-
322- import_annotations = MALPredictionImport .create_from_objects (
323- client = client ,
324- project_id = configured_project .uid ,
325- name = f"import { str (uuid .uuid4 ())} " ,
326- predictions = labels )
327-
328- assert import_annotations .errors == []
0 commit comments