Skip to content

Commit 4e54d49

Browse files
author
Val Brodsky
committed
Add tests
1 parent a616788 commit 4e54d49

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

tests/integration/conftest.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,18 @@ def consensus_project_with_batch(consensus_project, initial_dataset, rand_gen,
173173
project = consensus_project
174174
dataset = initial_dataset
175175

176-
task = dataset.create_data_rows([{DataRow.row_data: image_url}] * 3)
176+
data_rows = []
177+
for _ in range(3):
178+
data_rows.append({
179+
DataRow.row_data: image_url,
180+
DataRow.global_key: str(uuid.uuid4())
181+
})
182+
task = dataset.create_data_rows(data_rows)
177183
task.wait_till_done()
178184
assert task.status == "COMPLETE"
179185

180186
data_rows = list(dataset.data_rows())
181187
assert len(data_rows) == 3
182-
183188
batch = project.create_batch(
184189
rand_gen(str),
185190
data_rows, # sample of data row objects

tests/integration/test_labeling_parameter_overrides.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
from labelbox import DataRow
3+
from labelbox.schema.identifiables import GlobalKeys, UniqueIds
34

45

56
def test_labeling_parameter_overrides(consensus_project_with_batch):
@@ -49,8 +50,21 @@ def test_set_labeling_priority(consensus_project_with_batch):
4950

5051
data = [data_row.uid for data_row in data_rows]
5152
success = project.update_data_row_labeling_priority(data, 1)
53+
lo = list(project.labeling_parameter_overrides())
5254
assert success
55+
assert len(lo) == 3
56+
assert {o.priority for o in lo} == {1, 1, 1}
5357

54-
updated_overrides = list(project.labeling_parameter_overrides())
55-
assert len(updated_overrides) == 3
56-
assert {o.priority for o in updated_overrides} == {1, 1, 1}
58+
data = [data_row.uid for data_row in data_rows]
59+
success = project.update_data_row_labeling_priority(UniqueIds(data), 2)
60+
lo = list(project.labeling_parameter_overrides())
61+
assert success
62+
assert len(lo) == 3
63+
assert {o.priority for o in lo} == {2, 2, 2}
64+
65+
data = [data_row.global_key for data_row in data_rows]
66+
success = project.update_data_row_labeling_priority(GlobalKeys(data), 3)
67+
lo = list(project.labeling_parameter_overrides())
68+
assert success
69+
assert len(lo) == 3
70+
assert {o.priority for o in lo} == {3, 3, 3}

0 commit comments

Comments
 (0)