@@ -908,27 +908,40 @@ def test_data_row_bulk_creation_sync_with_unique_global_keys(
908908
909909
910910def test_data_row_bulk_creation_sync_with_same_global_keys (
911- dataset , sample_image ):
911+ dataset , sample_image , is_adv_enabled ):
912912 global_key_1 = str (uuid .uuid4 ())
913913
914- with pytest .raises (labelbox .exceptions .MalformedQueryException ):
914+ if is_adv_enabled :
915+ # ADV does not throw an error for duplicate global keys
916+ # but rather create the first one and reject the second
915917 dataset .create_data_rows_sync ([{
916918 DataRow .row_data : sample_image ,
917919 DataRow .global_key : global_key_1
918920 }, {
919921 DataRow .row_data : sample_image ,
920922 DataRow .global_key : global_key_1
921923 }])
924+ assert len (list (dataset .data_rows ())) == 1
925+ assert list (dataset .data_rows ())[0 ].global_key == global_key_1
926+ else :
927+ with pytest .raises (labelbox .exceptions .MalformedQueryException ):
928+ dataset .create_data_rows_sync ([{
929+ DataRow .row_data : sample_image ,
930+ DataRow .global_key : global_key_1
931+ }, {
932+ DataRow .row_data : sample_image ,
933+ DataRow .global_key : global_key_1
934+ }])
922935
923- assert len (list (dataset .data_rows ())) == 0
936+ assert len (list (dataset .data_rows ())) == 0
924937
925- dataset .create_data_rows_sync ([{
926- DataRow .row_data : sample_image ,
927- DataRow .global_key : global_key_1
928- }])
938+ dataset .create_data_rows_sync ([{
939+ DataRow .row_data : sample_image ,
940+ DataRow .global_key : global_key_1
941+ }])
929942
930- assert len (list (dataset .data_rows ())) == 1
931- assert list (dataset .data_rows ())[0 ].global_key == global_key_1
943+ assert len (list (dataset .data_rows ())) == 1
944+ assert list (dataset .data_rows ())[0 ].global_key == global_key_1
932945
933946
934947def test_create_conversational_text (dataset , conversational_content ):
0 commit comments