From d493647cca7d8c6fd57857e9dff77b67943e8331 Mon Sep 17 00:00:00 2001 From: Narek Mkhitaryan Date: Thu, 28 May 2026 15:34:23 +0400 Subject: [PATCH] new project settings --- src/superannotate/lib/core/__init__.py | 2 ++ .../projects/test_basic_project.py | 2 ++ .../projects/test_clone_project.py | 13 ++++++++- tests/integration/settings/test_settings.py | 29 +++++++++++-------- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/superannotate/lib/core/__init__.py b/src/superannotate/lib/core/__init__.py index 77f51b04..3d886672 100644 --- a/src/superannotate/lib/core/__init__.py +++ b/src/superannotate/lib/core/__init__.py @@ -184,6 +184,8 @@ def setup_logging(level=DEFAULT_LOGGING_LEVEL, file_path=LOG_FILE_LOCATION): "TemplateState", "CategorizeItems", "MaxIdleDuration", + "ItemAutoAssignOrder", + "ImageAutoAssignByCategory", ] __alL__ = ( diff --git a/tests/integration/projects/test_basic_project.py b/tests/integration/projects/test_basic_project.py index 78fd0cde..0b1910a3 100644 --- a/tests/integration/projects/test_basic_project.py +++ b/tests/integration/projects/test_basic_project.py @@ -34,6 +34,7 @@ class BaseMultimodalProjectCreate(TestCase): "readme": "", } MULTIMODAL_FORM = None + SETTINGS = None def setUp(self, *args, **kwargs): self.tearDown() @@ -48,6 +49,7 @@ def setUp(self, *args, **kwargs): self.PROJECT_NAME, self.PROJECT_DESCRIPTION, self.PROJECT_TYPE, + settings=self.SETTINGS, form=self.MULTIMODAL_FORM, ) diff --git a/tests/integration/projects/test_clone_project.py b/tests/integration/projects/test_clone_project.py index 035c6b40..f1484e80 100644 --- a/tests/integration/projects/test_clone_project.py +++ b/tests/integration/projects/test_clone_project.py @@ -254,8 +254,13 @@ def test_clone_video_project_frame_mode_off(self): class TestCloneMultimodalProject(BaseMultimodalProjectCreate): FORM_PATH = DATA_SET_PATH / "multimodal_form" / "form.json" - PROJECT_NAME = "test_clone_multimodal_project" + PROJECT_NAME = "test_multimodal_project" PROJECT_NAME_CLONE = "test_clone_multimodal_project_clone" + SETTINGS = [ + {"attribute": "ImageAutoAssignByCategory", "value": 1}, + {"attribute": "ItemAutoAssignOrder", "value": 4}, + {"attribute": "ImageAutoAssignCount", "value": 5}, + ] def tearDown(self) -> None: super().tearDown() @@ -294,6 +299,12 @@ def test_clone_multimodal_project(self): for s in cloned_project["settings"]: if s["attribute"] == "TemplateState": assert s["value"] == 1 + if s["attribute"] == "ImageAutoAssignByCategory": + assert s["value"] == 1 + if s["attribute"] == "ItemAutoAssignOrder": + assert s["value"] == 4 + if s["attribute"] == "ImageAutoAssignCount": + assert s["value"] == 5 def test_clone_multimodal_project_copy_settings_false(self): sa.clone_project( diff --git a/tests/integration/settings/test_settings.py b/tests/integration/settings/test_settings.py index 3ce9feb0..8fc9ee14 100644 --- a/tests/integration/settings/test_settings.py +++ b/tests/integration/settings/test_settings.py @@ -16,13 +16,11 @@ def setUp(self) -> None: def tearDown(self) -> None: try: - projects = sa.search_projects(self.PROJECT_NAME, return_metadata=True) - projects.extend( - sa.search_projects(self.SECOND_PROJECT_NAME, return_metadata=True) - ) + projects = sa.list_projects(name=self.PROJECT_NAME) + projects.extend(sa.list_projects(name=self.SECOND_PROJECT_NAME)) for project in projects: try: - sa.delete_project(project) + sa.delete_project(project=project["id"]) except Exception: pass except Exception as e: @@ -51,16 +49,19 @@ def test_create_project_with_settings(self): self.PROJECT_NAME, self.PROJECT_DESCRIPTION, self.PROJECT_TYPE, - [{"attribute": "ImageQuality", "value": "original"}], + settings=[ + {"attribute": "ImageQuality", "value": "original"}, + {"attribute": "ItemAutoAssignOrder", "value": 3}, + ], ) settings = sa.get_project_settings(self.PROJECT_NAME) + assert settings for setting in settings: if setting["attribute"] == "ImageQuality": assert setting["value"] == "original" - break - else: - raise Exception("Test failed") + if setting["attribute"] == "ItemAutoAssignOrder": + assert setting["value"] == 3 def test_frame_rate_invalid_range_value(self): with self.assertRaisesRegex( @@ -180,16 +181,20 @@ class TestMMSettings(BaseTestCase): "readme": "", } - def test_frame_rate(self): + def test_mm_project_specific_settings(self): sa.create_project( self.PROJECT_NAME, self.PROJECT_DESCRIPTION, self.PROJECT_TYPE, - settings=[{"attribute": "MaxIdleDuration", "value": 612}], + settings=[ + {"attribute": "MaxIdleDuration", "value": 612}, + {"attribute": "ImageAutoAssignByCategory", "value": 1}, + ], form=self.MULTIMODAL_FORM, ) settings = sa.get_project_settings(self.PROJECT_NAME) for setting in settings: if setting["attribute"] == "MaxIdleDuration": assert setting["value"] == 612 - break + if setting["attribute"] == "ImageAutoAssignByCategory": + assert setting["value"] == 1