Skip to content

Commit 2f1079a

Browse files
author
Val Brodsky
committed
Fix tests
1 parent e2b7e3b commit 2f1079a

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

libs/labelbox/tests/integration/test_data_rows.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from labelbox.schema.media_type import MediaType
1212
from labelbox import DataRow, AssetAttachment
13-
from labelbox.exceptions import MalformedQueryException, ResourceCreationError
13+
from labelbox.exceptions import MalformedQueryException, ResourceCreationError, InvalidQueryError
1414
from labelbox.schema.task import Task, DataUpsertTask
1515
from labelbox.schema.data_row_metadata import DataRowMetadataField, DataRowMetadataKind
1616

@@ -128,11 +128,11 @@ def test_get_data_row(data_row, client):
128128

129129

130130
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:
132132
dataset.create_data_row(row_data="s3://labelbox-public-data/invalid")
133133
assert "s3" in exc.value.message
134134

135-
with pytest.raises(labelbox.exceptions.InvalidQueryError) as exc:
135+
with pytest.raises(InvalidQueryError) as exc:
136136
dataset.create_data_rows([{
137137
"row_data": "s3://labelbox-public-data/invalid"
138138
}])
@@ -359,11 +359,11 @@ def test_create_data_row_with_dict_unpacked(dataset, image_url):
359359

360360

361361
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:
363363
dataset.create_data_row("asdf")
364364

365365
dr = {"row_data": image_url}
366-
with pytest.raises(labelbox.exceptions.InvalidQueryError) as exc:
366+
with pytest.raises(ResourceCreationError) as exc:
367367
dataset.create_data_row(dr, row_data=image_url)
368368

369369

@@ -421,7 +421,7 @@ def test_create_data_row_with_invalid_metadata(dataset, image_url):
421421
fields.append(
422422
DataRowMetadataField(schema_id=TEXT_SCHEMA_ID, value='some msg'))
423423

424-
with pytest.raises(labelbox.exceptions.MalformedQueryException):
424+
with pytest.raises(ResourceCreationError):
425425
dataset.create_data_row(row_data=image_url, metadata_fields=fields)
426426

427427

@@ -1103,7 +1103,7 @@ def test_invalid_media_type(dataset, conversational_content):
11031103
]]:
11041104
# TODO: What error kind should this be? It looks like for global key we are
11051105
# using malformed query. But for invalid contents in FileUploads we use InvalidQueryError
1106-
with pytest.raises(labelbox.exceptions.InvalidQueryError):
1106+
with pytest.raises(ResourceCreationError):
11071107
dataset.create_data_rows_sync([{
11081108
**conversational_content, 'media_type': 'IMAGE'
11091109
}])
@@ -1137,11 +1137,10 @@ def test_create_data_row_with_attachments(dataset):
11371137

11381138

11391139
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:
11411141
dr = dataset.create_data_row(
11421142
row_data={'invalid_object': 'invalid_value'}, media_type="IMAGE")
11431143

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)
11461145

11471146
dataset.create_data_row(row_data=image_url, media_type="IMAGE")

0 commit comments

Comments
 (0)