Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions tests/integration/test_data_rows.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,28 +922,21 @@ def test_data_row_bulk_creation_sync_with_same_global_keys(
dataset, sample_image, is_adv_enabled):
global_key_1 = str(uuid.uuid4())

if is_adv_enabled:
# ADV does not throw an error for duplicate global keys
# but rather create the first one and reject the second
with pytest.raises(labelbox.exceptions.MalformedQueryException) as exc_info:
dataset.create_data_rows_sync([{
DataRow.row_data: sample_image,
DataRow.global_key: global_key_1
}, {
DataRow.row_data: sample_image,
DataRow.global_key: global_key_1
}])

if is_adv_enabled:
# ADV will import the first data row but not the second (duplicate global key)
assert len(list(dataset.data_rows())) == 1
assert list(dataset.data_rows())[0].global_key == global_key_1
assert "Some data rows were not imported. Check error output here" in str(
exc_info.value)
else:
with pytest.raises(labelbox.exceptions.MalformedQueryException):
dataset.create_data_rows_sync([{
DataRow.row_data: sample_image,
DataRow.global_key: global_key_1
}, {
DataRow.row_data: sample_image,
DataRow.global_key: global_key_1
}])

assert len(list(dataset.data_rows())) == 0

dataset.create_data_rows_sync([{
Expand Down