Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion labelbox/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def _get_single(self, db_object_type, uid):
else:
return db_object_type(self, res)

def get_project(self, project_id):
def get_project(self, project_id) -> Project:
""" Gets a single Project with the given ID.

>>> project = client.get_project("<project_id>")
Expand Down
31 changes: 22 additions & 9 deletions tests/integration/test_data_rows.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,27 +908,40 @@ def test_data_row_bulk_creation_sync_with_unique_global_keys(


def test_data_row_bulk_creation_sync_with_same_global_keys(
dataset, sample_image):
dataset, sample_image, is_adv_enabled):
global_key_1 = str(uuid.uuid4())

with pytest.raises(labelbox.exceptions.MalformedQueryException):
if is_adv_enabled:
# ADV does not throw an error for duplicate global keys
# but rather create the first one and reject the second
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())) == 1
assert list(dataset.data_rows())[0].global_key == global_key_1
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
assert len(list(dataset.data_rows())) == 0

dataset.create_data_rows_sync([{
DataRow.row_data: sample_image,
DataRow.global_key: global_key_1
}])
dataset.create_data_rows_sync([{
DataRow.row_data: sample_image,
DataRow.global_key: global_key_1
}])

assert len(list(dataset.data_rows())) == 1
assert list(dataset.data_rows())[0].global_key == global_key_1
assert len(list(dataset.data_rows())) == 1
assert list(dataset.data_rows())[0].global_key == global_key_1


def test_create_conversational_text(dataset, conversational_content):
Expand Down