Skip to content

Commit be93909

Browse files
authored
Improve ADV assertion for bulk sync import (#1212)
1 parent b439780 commit be93909

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

tests/integration/test_data_rows.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -929,28 +929,21 @@ def test_data_row_bulk_creation_sync_with_same_global_keys(
929929
dataset, sample_image, is_adv_enabled):
930930
global_key_1 = str(uuid.uuid4())
931931

932-
if is_adv_enabled:
933-
# ADV does not throw an error for duplicate global keys
934-
# but rather create the first one and reject the second
932+
with pytest.raises(labelbox.exceptions.MalformedQueryException) as exc_info:
935933
dataset.create_data_rows_sync([{
936934
DataRow.row_data: sample_image,
937935
DataRow.global_key: global_key_1
938936
}, {
939937
DataRow.row_data: sample_image,
940938
DataRow.global_key: global_key_1
941939
}])
940+
941+
if is_adv_enabled:
942+
# ADV will import the first data row but not the second (duplicate global key)
942943
assert len(list(dataset.data_rows())) == 1
943-
assert list(dataset.data_rows())[0].global_key == global_key_1
944+
assert "Some data rows were not imported. Check error output here" in str(
945+
exc_info.value)
944946
else:
945-
with pytest.raises(labelbox.exceptions.MalformedQueryException):
946-
dataset.create_data_rows_sync([{
947-
DataRow.row_data: sample_image,
948-
DataRow.global_key: global_key_1
949-
}, {
950-
DataRow.row_data: sample_image,
951-
DataRow.global_key: global_key_1
952-
}])
953-
954947
assert len(list(dataset.data_rows())) == 0
955948

956949
dataset.create_data_rows_sync([{

0 commit comments

Comments
 (0)