Skip to content

Commit 6ff2492

Browse files
author
Claire Pajot
committed
Added and passing async tests
1 parent 1c21287 commit 6ff2492

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

tests/test_annotation.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,3 +402,19 @@ def test_box_gt_deletion(dataset):
402402
job_status = job.status()
403403
assert job_status["status"] == "Completed"
404404
assert job_status["job_id"] == job.id
405+
406+
@pytest.mark.integration
407+
def test_category_gt_deletion(dataset):
408+
annotation = CategoryAnnotation.from_json(TEST_CATEGORY_ANNOTATIONS[0])
409+
410+
print(annotation)
411+
412+
response = dataset.annotate(annotations=[annotation])
413+
414+
assert response["annotations_processed"] == 1
415+
416+
job = dataset.delete_annotations()
417+
job.sleep_until_complete()
418+
job_status = job.status()
419+
assert job_status["status"] == "Completed"
420+
assert job_status["job_id"] == job.id

tests/test_dataset.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,10 @@ def test_annotate_async(dataset: Dataset):
365365
semseg = SegmentationAnnotation.from_json(TEST_SEGMENTATION_ANNOTATIONS[0])
366366
polygon = PolygonAnnotation.from_json(TEST_POLYGON_ANNOTATIONS[0])
367367
bbox = BoxAnnotation(**TEST_BOX_ANNOTATIONS[0])
368+
category = CategoryAnnotation.from_json(TEST_CATEGORY_ANNOTATIONS[0])
368369

369370
job: AsyncJob = dataset.annotate(
370-
annotations=[semseg, polygon, bbox],
371+
annotations=[semseg, polygon, bbox, category],
371372
asynchronous=True,
372373
)
373374
job.sleep_until_complete()
@@ -377,11 +378,11 @@ def test_annotate_async(dataset: Dataset):
377378
"message": {
378379
"annotation_upload": {
379380
"epoch": 1,
380-
"total": 2,
381+
"total": 3,
381382
"errored": 0,
382383
"ignored": 0,
383384
"datasetId": dataset.id,
384-
"processed": 2,
385+
"processed": 3,
385386
},
386387
"segmentation_upload": {
387388
"ignored": 0,
@@ -390,8 +391,8 @@ def test_annotate_async(dataset: Dataset):
390391
},
391392
},
392393
"job_progress": "1.00",
393-
"completed_steps": 3,
394-
"total_steps": 3,
394+
"completed_steps": 4,
395+
"total_steps": 4,
395396
}
396397

397398

@@ -400,11 +401,12 @@ def test_annotate_async_with_error(dataset: Dataset):
400401
dataset.append(make_dataset_items())
401402
semseg = SegmentationAnnotation.from_json(TEST_SEGMENTATION_ANNOTATIONS[0])
402403
polygon = PolygonAnnotation.from_json(TEST_POLYGON_ANNOTATIONS[0])
404+
category = CategoryAnnotation.from_json(TEST_CATEGORY_ANNOTATIONS[0])
403405
bbox = BoxAnnotation(**TEST_BOX_ANNOTATIONS[0])
404406
bbox.reference_id = "fake_garbage"
405407

406408
job: AsyncJob = dataset.annotate(
407-
annotations=[semseg, polygon, bbox],
409+
annotations=[semseg, polygon, bbox, category],
408410
asynchronous=True,
409411
)
410412
job.sleep_until_complete()
@@ -415,11 +417,11 @@ def test_annotate_async_with_error(dataset: Dataset):
415417
"message": {
416418
"annotation_upload": {
417419
"epoch": 1,
418-
"total": 2,
420+
"total": 3,
419421
"errored": 1,
420422
"ignored": 0,
421423
"datasetId": dataset.id,
422-
"processed": 1,
424+
"processed": 2,
423425
},
424426
"segmentation_upload": {
425427
"ignored": 0,
@@ -428,8 +430,8 @@ def test_annotate_async_with_error(dataset: Dataset):
428430
},
429431
},
430432
"job_progress": "1.00",
431-
"completed_steps": 3,
432-
"total_steps": 3,
433+
"completed_steps": 4,
434+
"total_steps": 4,
433435
}
434436

435437
assert "Item with id fake_garbage doesn" in str(job.errors())

0 commit comments

Comments
 (0)