|
10 | 10 |
|
11 | 11 | from labelbox.schema.media_type import MediaType
|
12 | 12 | from labelbox import DataRow, AssetAttachment
|
13 |
| -from labelbox.exceptions import MalformedQueryException, ResourceCreationError |
| 13 | +from labelbox.exceptions import MalformedQueryException, ResourceCreationError, InvalidQueryError |
14 | 14 | from labelbox.schema.task import Task, DataUpsertTask
|
15 | 15 | from labelbox.schema.data_row_metadata import DataRowMetadataField, DataRowMetadataKind
|
16 | 16 |
|
@@ -128,11 +128,11 @@ def test_get_data_row(data_row, client):
|
128 | 128 |
|
129 | 129 |
|
130 | 130 | def test_create_invalid_aws_data_row(dataset, client):
|
131 |
| - with pytest.raises(labelbox.exceptions.InvalidQueryError) as exc: |
| 131 | + with pytest.raises(InvalidQueryError) as exc: |
132 | 132 | dataset.create_data_row(row_data="s3://labelbox-public-data/invalid")
|
133 | 133 | assert "s3" in exc.value.message
|
134 | 134 |
|
135 |
| - with pytest.raises(labelbox.exceptions.InvalidQueryError) as exc: |
| 135 | + with pytest.raises(InvalidQueryError) as exc: |
136 | 136 | dataset.create_data_rows([{
|
137 | 137 | "row_data": "s3://labelbox-public-data/invalid"
|
138 | 138 | }])
|
@@ -359,11 +359,11 @@ def test_create_data_row_with_dict_unpacked(dataset, image_url):
|
359 | 359 |
|
360 | 360 |
|
361 | 361 | def test_create_data_row_with_invalid_input(dataset, image_url):
|
362 |
| - with pytest.raises(labelbox.exceptions.InvalidQueryError) as exc: |
| 362 | + with pytest.raises(ResourceCreationError) as exc: |
363 | 363 | dataset.create_data_row("asdf")
|
364 | 364 |
|
365 | 365 | dr = {"row_data": image_url}
|
366 |
| - with pytest.raises(labelbox.exceptions.InvalidQueryError) as exc: |
| 366 | + with pytest.raises(ResourceCreationError) as exc: |
367 | 367 | dataset.create_data_row(dr, row_data=image_url)
|
368 | 368 |
|
369 | 369 |
|
@@ -421,7 +421,7 @@ def test_create_data_row_with_invalid_metadata(dataset, image_url):
|
421 | 421 | fields.append(
|
422 | 422 | DataRowMetadataField(schema_id=TEXT_SCHEMA_ID, value='some msg'))
|
423 | 423 |
|
424 |
| - with pytest.raises(labelbox.exceptions.MalformedQueryException): |
| 424 | + with pytest.raises(ResourceCreationError): |
425 | 425 | dataset.create_data_row(row_data=image_url, metadata_fields=fields)
|
426 | 426 |
|
427 | 427 |
|
@@ -1103,7 +1103,7 @@ def test_invalid_media_type(dataset, conversational_content):
|
1103 | 1103 | ]]:
|
1104 | 1104 | # TODO: What error kind should this be? It looks like for global key we are
|
1105 | 1105 | # using malformed query. But for invalid contents in FileUploads we use InvalidQueryError
|
1106 |
| - with pytest.raises(labelbox.exceptions.InvalidQueryError): |
| 1106 | + with pytest.raises(ResourceCreationError): |
1107 | 1107 | dataset.create_data_rows_sync([{
|
1108 | 1108 | **conversational_content, 'media_type': 'IMAGE'
|
1109 | 1109 | }])
|
@@ -1137,11 +1137,10 @@ def test_create_data_row_with_attachments(dataset):
|
1137 | 1137 |
|
1138 | 1138 |
|
1139 | 1139 | def test_create_data_row_with_media_type(dataset, image_url):
|
1140 |
| - with pytest.raises(labelbox.exceptions.InvalidQueryError) as exc: |
| 1140 | + with pytest.raises(ResourceCreationError) as exc: |
1141 | 1141 | dr = dataset.create_data_row(
|
1142 | 1142 | row_data={'invalid_object': 'invalid_value'}, media_type="IMAGE")
|
1143 | 1143 |
|
1144 |
| - assert "Media type validation failed, expected: 'image/*', was: application/json" in str( |
1145 |
| - exc.value) |
| 1144 | + assert "Expected type image/*, detected: application/json" in str(exc.value) |
1146 | 1145 |
|
1147 | 1146 | dataset.create_data_row(row_data=image_url, media_type="IMAGE")
|
0 commit comments