From 6f725a3178ecb2f3e89fa33d86d5c530b0250bc6 Mon Sep 17 00:00:00 2001 From: kozikkamil Date: Thu, 25 Jul 2024 11:56:43 +0200 Subject: [PATCH 1/2] [X-0] Add field definitions --- libs/labelbox/src/labelbox/schema/project.py | 6 +++++- libs/labelbox/tests/integration/test_legacy_project.py | 10 ++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libs/labelbox/src/labelbox/schema/project.py b/libs/labelbox/src/labelbox/schema/project.py index 1fd87c7e5..ee3a29c41 100644 --- a/libs/labelbox/src/labelbox/schema/project.py +++ b/libs/labelbox/src/labelbox/schema/project.py @@ -83,7 +83,7 @@ def validate_labeling_parameter_overrides( class Project(DbObject, Updateable, Deletable): - """ A Project is a container that includes a labeling frontend, an ontology, + """A Project is a container that includes a labeling frontend, an ontology, datasets and labels. Attributes: @@ -96,6 +96,8 @@ class Project(DbObject, Updateable, Deletable): queue_mode (string) auto_audit_number_of_labels (int) auto_audit_percentage (float) + is_benchmark_enabled (bool) + is_consensus_enabled (bool) created_by (Relationship): `ToOne` relationship to User organization (Relationship): `ToOne` relationship to Organization @@ -123,6 +125,8 @@ class Project(DbObject, Updateable, Deletable): data_row_count = Field.Int("data_row_count") model_setup_complete: Field = Field.Boolean("model_setup_complete") upload_type: Field = Field.Enum(UploadType, "upload_type") + is_benchmark_enabled = Field.Boolean("is_benchmark_enabled") + is_consensus_enabled = Field.Boolean("is_consensus_enabled") # Relationships created_by = Relationship.ToOne("User", False, "created_by") diff --git a/libs/labelbox/tests/integration/test_legacy_project.py b/libs/labelbox/tests/integration/test_legacy_project.py index 6573beffd..fbdf8b252 100644 --- a/libs/labelbox/tests/integration/test_legacy_project.py +++ b/libs/labelbox/tests/integration/test_legacy_project.py @@ -17,16 +17,14 @@ def test_project_dataset(client, rand_gen): def test_project_auto_audit_parameters(client, rand_gen): with pytest.raises( - ValueError, - match= - "quality_mode must be set instead of auto_audit_percentage or auto_audit_number_of_labels." + ValueError, + match="quality_modes must be set instead of auto_audit_percentage or auto_audit_number_of_labels.", ): client.create_project(name=rand_gen(str), auto_audit_percentage=0.5) with pytest.raises( - ValueError, - match= - "quality_mode must be set instead of auto_audit_percentage or auto_audit_number_of_labels." + ValueError, + match="quality_modes must be set instead of auto_audit_percentage or auto_audit_number_of_labels.", ): client.create_project(name=rand_gen(str), auto_audit_number_of_labels=2) From 1de569aaccbfe92a26e7c29cc0df77142510a78a Mon Sep 17 00:00:00 2001 From: kozikkamil Date: Thu, 25 Jul 2024 18:50:14 +0200 Subject: [PATCH 2/2] Fix units --- libs/labelbox/tests/unit/test_project.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libs/labelbox/tests/unit/test_project.py b/libs/labelbox/tests/unit/test_project.py index ff0c75b6c..367f74296 100644 --- a/libs/labelbox/tests/unit/test_project.py +++ b/libs/labelbox/tests/unit/test_project.py @@ -8,7 +8,8 @@ @pytest.fixture def project_entity(): return Project( - MagicMock(), { + MagicMock(), + { "id": "test", "name": "test", "createdAt": "2021-06-01T00:00:00.000Z", @@ -24,7 +25,10 @@ def project_entity(): "setupComplete": "2021-06-01T00:00:00.000Z", "modelSetupComplete": None, "uploadType": "Auto", - }) + "isBenchmarkEnabled": False, + "isConsensusEnabled": False, + }, + ) @pytest.mark.parametrize( @@ -39,7 +43,8 @@ def test_project_editor_task_type(api_editor_task_type, expected_editor_task_type, project_entity): client = MagicMock() project = Project( - client, { + client, + { "id": "test", "name": "test", "createdAt": "2021-06-01T00:00:00.000Z", @@ -55,7 +60,10 @@ def test_project_editor_task_type(api_editor_task_type, "setupComplete": "2021-06-01T00:00:00.000Z", "modelSetupComplete": None, "uploadType": "Auto", - }) + "isBenchmarkEnabled": False, + "isConsensusEnabled": False, + }, + ) assert project.editor_task_type == expected_editor_task_type