@@ -309,9 +309,9 @@ def test_dataset_append_async(dataset: Dataset):
309309
310310def test_dataset_append_async_with_local_path (dataset : Dataset ):
311311 ds_items = make_dataset_items ()
312- ds_items [
313- 0
314- ]. image_location = "/a/fake/local/path/you/can/tell/is/local/but/is/fake"
312+ ds_items [0 ]. image_location = (
313+ "/a/fake/local/path/you/can/tell/is/local/but/is/fake"
314+ )
315315 with pytest .raises (ValueError ):
316316 dataset .append (ds_items , asynchronous = True )
317317
@@ -354,8 +354,7 @@ def test_raises_error_for_duplicate():
354354 ]
355355 )
356356 assert (
357- str (error .value )
358- == "Duplicate reference IDs found among dataset_items:"
357+ str (error .value ) == "Duplicate reference IDs found among dataset_items:"
359358 " {'duplicate': 'Count: 2'}"
360359 )
361360
@@ -480,9 +479,7 @@ def sort_labelmap(segmentation_annotation):
480479 exported [0 ][ANNOTATIONS_KEY ][SEGMENTATION_TYPE ]
481480 ) == sort_labelmap (clear_fields (segmentation_annotation ))
482481 assert exported [0 ][ANNOTATIONS_KEY ][POLYGON_TYPE ][0 ] == polygon_annotation
483- assert (
484- exported [0 ][ANNOTATIONS_KEY ][CATEGORY_TYPE ][0 ] == category_annotation
485- )
482+ assert exported [0 ][ANNOTATIONS_KEY ][CATEGORY_TYPE ][0 ] == category_annotation
486483 exported [0 ][ANNOTATIONS_KEY ][MULTICATEGORY_TYPE ][0 ].labels = set (
487484 exported [0 ][ANNOTATIONS_KEY ][MULTICATEGORY_TYPE ][0 ].labels
488485 )
@@ -535,8 +532,7 @@ def test_dataset_item_iterator(dataset):
535532 dataset .append (items )
536533 expected_items = {item .reference_id : item for item in dataset .items }
537534 actual_items = {
538- item .reference_id : item
539- for item in dataset .items_generator (page_size = 1 )
535+ item .reference_id : item for item in dataset .items_generator (page_size = 1 )
540536 }
541537 for key in expected_items :
542538 assert actual_items [key ] == expected_items [key ]
@@ -610,3 +606,19 @@ def test_create_update_dataset_from_dir(CLIENT):
610606 assert dataset_item .reference_id in reference_ids
611607 reference_ids .remove (dataset_item .reference_id )
612608 CLIENT .delete_dataset (dataset .id )
609+
610+
611+ @pytest .mark .integration
612+ def test_dataset_export_class_labels (dataset ):
613+ dataset .append (make_dataset_items ())
614+ # Create box annotation from the test data
615+ box_annotation = BoxAnnotation (** TEST_BOX_ANNOTATIONS [0 ])
616+ dataset .annotate (annotations = [box_annotation ])
617+
618+ # Wait annotations to be uploaded (takes a while)
619+ import time
620+
621+ time .sleep (40 )
622+ class_labels = dataset .export_class_labels ()
623+ # Compare against just the label from the test annotation
624+ assert class_labels == [box_annotation .label ]
0 commit comments