Skip to content

Commit dbfa46a

Browse files
authored
[X-0] Add field definitions (#1745)
1 parent 2a56698 commit dbfa46a

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

libs/labelbox/src/labelbox/schema/project.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def validate_labeling_parameter_overrides(
8383

8484

8585
class Project(DbObject, Updateable, Deletable):
86-
""" A Project is a container that includes a labeling frontend, an ontology,
86+
"""A Project is a container that includes a labeling frontend, an ontology,
8787
datasets and labels.
8888
8989
Attributes:
@@ -96,6 +96,8 @@ class Project(DbObject, Updateable, Deletable):
9696
queue_mode (string)
9797
auto_audit_number_of_labels (int)
9898
auto_audit_percentage (float)
99+
is_benchmark_enabled (bool)
100+
is_consensus_enabled (bool)
99101
100102
created_by (Relationship): `ToOne` relationship to User
101103
organization (Relationship): `ToOne` relationship to Organization
@@ -123,6 +125,8 @@ class Project(DbObject, Updateable, Deletable):
123125
data_row_count = Field.Int("data_row_count")
124126
model_setup_complete: Field = Field.Boolean("model_setup_complete")
125127
upload_type: Field = Field.Enum(UploadType, "upload_type")
128+
is_benchmark_enabled = Field.Boolean("is_benchmark_enabled")
129+
is_consensus_enabled = Field.Boolean("is_consensus_enabled")
126130

127131
# Relationships
128132
created_by = Relationship.ToOne("User", False, "created_by")

libs/labelbox/tests/integration/test_legacy_project.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@ def test_project_dataset(client, rand_gen):
1717

1818
def test_project_auto_audit_parameters(client, rand_gen):
1919
with pytest.raises(
20-
ValueError,
21-
match=
22-
"quality_mode must be set instead of auto_audit_percentage or auto_audit_number_of_labels."
20+
ValueError,
21+
match="quality_modes must be set instead of auto_audit_percentage or auto_audit_number_of_labels.",
2322
):
2423
client.create_project(name=rand_gen(str), auto_audit_percentage=0.5)
2524

2625
with pytest.raises(
27-
ValueError,
28-
match=
29-
"quality_mode must be set instead of auto_audit_percentage or auto_audit_number_of_labels."
26+
ValueError,
27+
match="quality_modes must be set instead of auto_audit_percentage or auto_audit_number_of_labels.",
3028
):
3129
client.create_project(name=rand_gen(str), auto_audit_number_of_labels=2)
3230

libs/labelbox/tests/unit/test_project.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
@pytest.fixture
99
def project_entity():
1010
return Project(
11-
MagicMock(), {
11+
MagicMock(),
12+
{
1213
"id": "test",
1314
"name": "test",
1415
"createdAt": "2021-06-01T00:00:00.000Z",
@@ -24,7 +25,10 @@ def project_entity():
2425
"setupComplete": "2021-06-01T00:00:00.000Z",
2526
"modelSetupComplete": None,
2627
"uploadType": "Auto",
27-
})
28+
"isBenchmarkEnabled": False,
29+
"isConsensusEnabled": False,
30+
},
31+
)
2832

2933

3034
@pytest.mark.parametrize(
@@ -39,7 +43,8 @@ def test_project_editor_task_type(api_editor_task_type,
3943
expected_editor_task_type, project_entity):
4044
client = MagicMock()
4145
project = Project(
42-
client, {
46+
client,
47+
{
4348
"id": "test",
4449
"name": "test",
4550
"createdAt": "2021-06-01T00:00:00.000Z",
@@ -55,7 +60,10 @@ def test_project_editor_task_type(api_editor_task_type,
5560
"setupComplete": "2021-06-01T00:00:00.000Z",
5661
"modelSetupComplete": None,
5762
"uploadType": "Auto",
58-
})
63+
"isBenchmarkEnabled": False,
64+
"isConsensusEnabled": False,
65+
},
66+
)
5967

6068
assert project.editor_task_type == expected_editor_task_type
6169

0 commit comments

Comments
 (0)