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
7 changes: 6 additions & 1 deletion labelbox/schema/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self,
client,
project_id,
*args,
failed_data_row_ids=None,
failed_data_row_ids=[],
**kwargs):
super().__init__(client, *args, **kwargs)
self.project_id = project_id
Expand Down Expand Up @@ -187,6 +187,11 @@ def delete_labels(self, set_labels_as_template=False) -> None:
experimental=True)
return res

# modify this function to return an empty list if there are no failed data rows

@property
def failed_data_row_ids(self):
if self._failed_data_row_ids is None:
self._failed_data_row_ids = []

return (x for x in self._failed_data_row_ids)
11 changes: 10 additions & 1 deletion tests/integration/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@ def get_data_row_ids(ds: Dataset):


def test_create_batch(project: Project, big_dataset_data_row_ids: List[str]):
batch = project.create_batch("test-batch", big_dataset_data_row_ids, 3)
batch = project.create_batch("test-batch",
big_dataset_data_row_ids,
3,
consensus_settings={
'number_of_labels': 3,
'coverage_percentage': 0.1
})

assert batch.name == "test-batch"
assert batch.size == len(big_dataset_data_row_ids)
assert len([dr for dr in batch.failed_data_row_ids]) == 0


def test_create_batch_with_invalid_data_rows_ids(project: Project):
Expand Down Expand Up @@ -101,6 +109,7 @@ def test_create_batch_async(project: Project,
priority=3)
assert batch.name == "big-batch"
assert batch.size == len(big_dataset_data_row_ids)
assert len([dr for dr in batch.failed_data_row_ids]) == 0


def test_create_batch_with_consensus_settings(project: Project,
Expand Down