Skip to content

Commit 885274a

Browse files
authored
adjust error message for taxonomy error (#208)
* adjust error message for taxonomy error * other test
1 parent b9cb37f commit 885274a

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

tests/test_annotation.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,7 @@ def test_non_existent_taxonomy_category_gt_upload_async(dataset):
768768
annotation = CategoryAnnotation.from_json(
769769
TEST_NONEXISTENT_TAXONOMY_CATEGORY_ANNOTATION[0]
770770
)
771+
error_msg = f'Input validation failed: Taxonomy {TEST_NONEXISTENT_TAXONOMY_CATEGORY_ANNOTATION[0]["taxonomy_name"]} does not exist in dataset {dataset.id}, or label {annotation.label} does not exist in the taxonomy {TEST_NONEXISTENT_TAXONOMY_CATEGORY_ANNOTATION[0]["taxonomy_name"]}.'
771772

772773
try:
773774
job: AsyncJob = dataset.annotate(
@@ -778,18 +779,15 @@ def test_non_existent_taxonomy_category_gt_upload_async(dataset):
778779
)
779780
job.sleep_until_complete()
780781
except JobError:
781-
assert (
782-
f'Input validation failed: Taxonomy {TEST_NONEXISTENT_TAXONOMY_CATEGORY_ANNOTATION[0]["taxonomy_name"]} does not exist in dataset {dataset.id}'
783-
in job.errors()[-1]
784-
)
782+
assert error_msg in job.errors()[-1]
785783

786784
assert job.status() == {
787785
"job_id": job.job_id,
788786
"status": "Errored",
789787
"message": {
790-
"status_log": "No additional information can be provided at this time."
788+
"final_error": f"BadRequestError: {error_msg}",
791789
},
792-
"job_progress": "0.00",
793-
"completed_steps": 0,
790+
"job_progress": "1.00",
791+
"completed_steps": 1,
794792
"total_steps": 1,
795793
}

tests/test_prediction.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,11 @@ def test_default_category_pred_upload_async(model_run: ModelRun):
594594

595595

596596
@pytest.mark.integration
597-
def test_non_existent_taxonomy_category_gt_upload_async(model_run: ModelRun):
597+
def test_non_existent_taxonomy_category_pred_upload_async(model_run: ModelRun):
598598
prediction = CategoryPrediction.from_json(
599599
TEST_NONEXISTENT_TAXONOMY_CATEGORY_PREDICTION[0]
600600
)
601+
error_msg = f'Input validation failed: Taxonomy {TEST_NONEXISTENT_TAXONOMY_CATEGORY_PREDICTION[0]["taxonomy_name"]} does not exist in dataset {model_run.dataset_id}, or label {prediction.label} does not exist in the taxonomy {TEST_NONEXISTENT_TAXONOMY_CATEGORY_PREDICTION[0]["taxonomy_name"]}.'
601602
try:
602603
job: AsyncJob = model_run.predict(
603604
annotations=[
@@ -606,19 +607,17 @@ def test_non_existent_taxonomy_category_gt_upload_async(model_run: ModelRun):
606607
asynchronous=True,
607608
)
608609
job.sleep_until_complete()
610+
609611
except JobError:
610-
assert (
611-
f'Input validation failed: Taxonomy {TEST_NONEXISTENT_TAXONOMY_CATEGORY_PREDICTION[0]["taxonomy_name"]} does not exist in dataset'
612-
in job.errors()[-1]
613-
)
612+
assert error_msg in job.errors()[-1]
614613

615614
assert job.status() == {
616615
"job_id": job.job_id,
617616
"status": "Errored",
618617
"message": {
619-
"status_log": "No additional information can be provided at this time."
618+
"final_error": f"BadRequestError: {error_msg}",
620619
},
621-
"job_progress": "0.00",
622-
"completed_steps": 0,
620+
"job_progress": "1.00",
621+
"completed_steps": 1,
623622
"total_steps": 1,
624623
}

0 commit comments

Comments
 (0)