From 6cdf7f46c207e968ecbc51558ef0a832bdb5300b Mon Sep 17 00:00:00 2001 From: Attila Papai Date: Thu, 3 Aug 2023 16:39:46 +0200 Subject: [PATCH 1/2] fix assert for ADV --- tests/integration/test_data_rows.py | 31 ++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) 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): From 3c9a3f342157f3cd56158f3748af7e19df8f041c Mon Sep 17 00:00:00 2001 From: Attila Papai Date: Thu, 3 Aug 2023 17:02:01 +0200 Subject: [PATCH 2/2] add return type to get_project --- labelbox/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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("")