Skip to content

Commit c4247b0

Browse files
author
Val Brodsky
committed
Add test for MAL
1 parent 9c838b0 commit c4247b0

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

tests/data/serialization/ndjson/test_video.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from labelbox import parser
1313

1414
from labelbox.data.serialization.ndjson.converter import NDJsonConverter
15-
from labelbox.schema.annotation_import import MALPredictionImport
1615

1716

1817
def test_video():

tests/integration/annotation_import/test_data_types.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,17 @@ def one_datarow(client, rand_gen, data_row_json_by_data_type, data_type):
366366
dataset.delete()
367367

368368

369+
@pytest.fixture
370+
def one_datarow_global_key(client, rand_gen, data_row_json_by_data_type):
371+
dataset = client.create_dataset(name=rand_gen(str))
372+
data_row_json = data_row_json_by_data_type['video']
373+
data_row = dataset.create_data_row(data_row_json)
374+
375+
yield data_row
376+
377+
dataset.delete()
378+
379+
369380
@pytest.mark.parametrize('data_type, data_class, annotations', test_params)
370381
def test_import_mal_annotations(client, configured_project_with_one_data_row,
371382
data_type, data_class, annotations, rand_gen,
@@ -393,3 +404,33 @@ def test_import_mal_annotations(client, configured_project_with_one_data_row,
393404

394405
assert import_annotations.errors == []
395406
# MAL Labels cannot be exported and compared to input labels
407+
408+
409+
def test_import_mal_annotations_global_key(client,
410+
configured_project_with_one_data_row,
411+
rand_gen, one_datarow_global_key):
412+
data_class = lb_types.VideoData
413+
data_row = one_datarow_global_key
414+
annotations = [video_mask_annotation]
415+
set_project_media_type_from_data_type(configured_project_with_one_data_row,
416+
data_class)
417+
418+
configured_project_with_one_data_row.create_batch(
419+
rand_gen(str),
420+
[data_row.uid],
421+
)
422+
423+
labels = [
424+
lb_types.Label(data=data_class(global_key=data_row.global_key),
425+
annotations=annotations)
426+
]
427+
428+
import_annotations = lb.MALPredictionImport.create_from_objects(
429+
client=client,
430+
project_id=configured_project_with_one_data_row.uid,
431+
name=f"import {str(uuid.uuid4())}",
432+
predictions=labels)
433+
import_annotations.wait_until_done()
434+
435+
assert import_annotations.errors == []
436+
# MAL Labels cannot be exported and compared to input labels

0 commit comments

Comments
 (0)