diff --git a/labelbox/client.py b/labelbox/client.py index 8b19d5431..ce1ebe33c 100644 --- a/labelbox/client.py +++ b/labelbox/client.py @@ -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("") diff --git a/tests/integration/test_data_rows.py b/tests/integration/test_data_rows.py index a70c1c41b..a183b6d83 100644 --- a/tests/integration/test_data_rows.py +++ b/tests/integration/test_data_rows.py @@ -908,10 +908,12 @@ 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 @@ -919,16 +921,27 @@ def test_data_row_bulk_creation_sync_with_same_global_keys( 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):