From d493647cca7d8c6fd57857e9dff77b67943e8331 Mon Sep 17 00:00:00 2001 From: Narek Mkhitaryan Date: Thu, 28 May 2026 15:34:23 +0400 Subject: [PATCH 1/3] 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 From 355e2fbffffee7de41d6a79dd94d0791e48b681d Mon Sep 17 00:00:00 2001 From: Narek Mkhitaryan Date: Thu, 28 May 2026 18:16:14 +0400 Subject: [PATCH 2/3] depricate PointCloud/Tiled fix tests --- .../lib/app/interface/sdk_interface.py | 4 +--- .../aggregations/test_df_processing.py | 3 ++- tests/integration/export/test_export.py | 4 ++-- .../integration/items/test_attach_category.py | 6 +++--- .../integration/items/test_generate_items.py | 5 +++-- .../mixpanel/test_mixpanel_decorator.py | 4 ++-- .../projects/test_create_project.py | 9 ++++++++- .../projects/test_project_rename.py | 15 +++++++------- .../projects/test_search_project.py | 18 ++++++++--------- tests/integration/settings/test_settings.py | 20 ++++++++----------- tests/integration/test_cli.py | 7 +++++-- .../test_depricated_functions_document.py | 11 +++++----- .../test_depricated_functions_video.py | 8 +++++--- tests/integration/test_video.py | 12 +++++++---- .../tiled_project/test_tiled_project.py | 14 ------------- .../test_contributors_categories.py | 6 +++--- .../test_project_categories.py | 6 +++--- .../test_project_user_permissions.py | 6 +++--- .../work_management/test_user_scoring.py | 6 +++--- 19 files changed, 80 insertions(+), 84 deletions(-) delete mode 100644 tests/integration/tiled_project/test_tiled_project.py diff --git a/src/superannotate/lib/app/interface/sdk_interface.py b/src/superannotate/lib/app/interface/sdk_interface.py index 3a9387e2..ee940303 100644 --- a/src/superannotate/lib/app/interface/sdk_interface.py +++ b/src/superannotate/lib/app/interface/sdk_interface.py @@ -96,8 +96,6 @@ "Vector", "Video", "Document", - "Tiled", - "PointCloud", "Multimodal", ] @@ -1409,7 +1407,7 @@ def create_project( :param project_description: The new project's description. :type project_description: str - :param project_type: The project type. Supported types: 'Vector', 'Video', 'Document', 'Tiled', 'PointCloud', 'Multimodal'. + :param project_type: The project type. Supported types: 'Vector', 'Video', 'Document', 'Multimodal'. :type project_type: str :param settings: list of settings objects diff --git a/tests/integration/aggregations/test_df_processing.py b/tests/integration/aggregations/test_df_processing.py index 321b1379..b401351d 100644 --- a/tests/integration/aggregations/test_df_processing.py +++ b/tests/integration/aggregations/test_df_processing.py @@ -30,7 +30,8 @@ def test_filter_instances(self): def test_invalid_project_type(self): with self.assertRaisesRegex( - AppException, "The function is not supported for PointCloud projects." + AppException, + "Input should be 'Vector', 'Video', 'Document' or 'Multimodal'", ): sa.aggregate_annotations_as_df(self.folder_path, "PointCloud") diff --git a/tests/integration/export/test_export.py b/tests/integration/export/test_export.py index b97c844e..25ddb215 100644 --- a/tests/integration/export/test_export.py +++ b/tests/integration/export/test_export.py @@ -65,10 +65,10 @@ def setUpClass(cls) -> None: @classmethod def tearDownClass(cls) -> None: - projects = sa.search_projects(cls.PROJECT_NAME, return_metadata=True) + projects = sa.list_projects(name=cls.PROJECT_NAME) for project in projects: try: - sa.delete_project(project) + sa.delete_project(project=project["id"]) except AppException as e: logging.error(e) diff --git a/tests/integration/items/test_attach_category.py b/tests/integration/items/test_attach_category.py index 4515be1c..965be340 100644 --- a/tests/integration/items/test_attach_category.py +++ b/tests/integration/items/test_attach_category.py @@ -66,11 +66,11 @@ def setUpClass(cls, *args, **kwargs) -> None: @classmethod def tearDownClass(cls) -> None: # cleanup test scores and project - projects = sa.search_projects(cls.PROJECT_NAME, return_metadata=True) + projects = sa.list_projects(name__in=[cls.PROJECT_NAME]) for project in projects: try: - sa.delete_project(project) - except Exception: + sa.delete_project(project=project["id"]) + except Exception as _: pass @staticmethod diff --git a/tests/integration/items/test_generate_items.py b/tests/integration/items/test_generate_items.py index 9f895bab..352c80e8 100644 --- a/tests/integration/items/test_generate_items.py +++ b/tests/integration/items/test_generate_items.py @@ -27,6 +27,7 @@ class TestGenerateItemsMM(TestCase): } def setUp(self, *args, **kwargs): + self.tearDown() sa.create_project( self.PROJECT_NAME, self.PROJECT_DESCRIPTION, @@ -37,10 +38,10 @@ def setUp(self, *args, **kwargs): def tearDown(self) -> None: try: - projects = sa.search_projects(self.PROJECT_NAME, return_metadata=True) + projects = sa.list_projects(name=self.PROJECT_NAME) for project in projects: try: - sa.delete_project(project) + sa.delete_project(project=project["id"]) except Exception as e: print(str(e)) except Exception as e: diff --git a/tests/integration/mixpanel/test_mixpanel_decorator.py b/tests/integration/mixpanel/test_mixpanel_decorator.py index 52f96614..855bf3c4 100644 --- a/tests/integration/mixpanel/test_mixpanel_decorator.py +++ b/tests/integration/mixpanel/test_mixpanel_decorator.py @@ -44,10 +44,10 @@ def tearDownClass(cls) -> None: @classmethod def _safe_delete_project(cls, project_name): - projects = sa.search_projects(project_name, return_metadata=True) + projects = sa.list_projects(name=project_name) for project in projects: try: - sa.delete_project(project) + sa.delete_project(project=project["id"]) except Exception: raise diff --git a/tests/integration/projects/test_create_project.py b/tests/integration/projects/test_create_project.py index ef5e604b..5dcf04a6 100644 --- a/tests/integration/projects/test_create_project.py +++ b/tests/integration/projects/test_create_project.py @@ -95,7 +95,7 @@ def test_create_project_datetime(self): def test_create_project_with_wrong_type(self): with self.assertRaisesRegex( AppException, - "Input should be 'Vector', 'Video', 'Document', 'Tiled', 'PointCloud' or 'Multimodal'", + "Input should be 'Vector', 'Video', 'Document' or 'Multimodal'", ): sa.create_project(self.PROJECT, "desc", "wrong_type") @@ -130,6 +130,13 @@ def test_create_project_with_classes_and_workflows(self): assert steps[1]["attribute"][0]["attribute"]["name"] == "Track" assert steps[1]["attribute"][1]["attribute"]["name"] == "Bus" + def test_deprecated_project_crate(self): + error_msg = "Input should be 'Vector', 'Video', 'Document' or 'Multimodal'" + with self.assertRaisesRegex(AppException, error_msg): + sa.create_project(self.PROJECT, "desc", "Tiled") + with self.assertRaisesRegex(AppException, error_msg): + sa.create_project(self.PROJECT, "desc", "PointCloud") + class TestCreateVideoProject(ProjectCreateBaseTestCase): PROJECT = "test_video_project" diff --git a/tests/integration/projects/test_project_rename.py b/tests/integration/projects/test_project_rename.py index d63eebed..1a58068a 100644 --- a/tests/integration/projects/test_project_rename.py +++ b/tests/integration/projects/test_project_rename.py @@ -20,16 +20,17 @@ def setUp(self, *args, **kwargs): ) def tearDown(self) -> None: - projects = [] - projects.extend(sa.search_projects(self.PROJECT_NAME, return_metadata=True)) - projects.extend(sa.search_projects(self.NEW_PROJECT_NAME, return_metadata=True)) - projects.extend( - sa.search_projects(self.REPLACED_PROJECT_NAME, return_metadata=True) + projects = sa.list_projects( + name__in=[ + self.PROJECT_NAME, + self.NEW_PROJECT_NAME, + self.REPLACED_PROJECT_NAME, + self.NAME_TO_RENAME, + ] ) - projects.extend(sa.search_projects(self.NAME_TO_RENAME, return_metadata=True)) for project in projects: try: - sa.delete_project(project) + sa.delete_project(project=project["id"]) except Exception as _: pass diff --git a/tests/integration/projects/test_search_project.py b/tests/integration/projects/test_search_project.py index f9673606..3a903633 100644 --- a/tests/integration/projects/test_search_project.py +++ b/tests/integration/projects/test_search_project.py @@ -22,19 +22,17 @@ def setUp(self, *args, **kwargs): ) def tearDown(self) -> None: - projects = [] - projects.extend(sa.search_projects(self.PROJECT_NAME, return_metadata=True)) - projects.extend( - sa.search_projects(self.REPLACED_PROJECT_NAME, return_metadata=True) - ) - projects.extend( - sa.search_projects( - self.PROJECT_NAME_CONTAIN_SPECIAL_CHARACTER, return_metadata=True - ) + projects = sa.list_projects( + name__in=[ + self.PROJECT_NAME, + self.PROJECT_NAME_2, + self.REPLACED_PROJECT_NAME, + self.PROJECT_NAME_CONTAIN_SPECIAL_CHARACTER, + ] ) for project in projects: try: - sa.delete_project(project) + sa.delete_project(project=project["id"]) except Exception as _: pass diff --git a/tests/integration/settings/test_settings.py b/tests/integration/settings/test_settings.py index 3ce9feb0..33bb3d47 100644 --- a/tests/integration/settings/test_settings.py +++ b/tests/integration/settings/test_settings.py @@ -15,18 +15,14 @@ def setUp(self) -> None: self.tearDown() 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) - ) - for project in projects: - try: - sa.delete_project(project) - except Exception: - pass - except Exception as e: - print(str(e)) + projects = sa.list_projects( + name__in=[self.PROJECT_NAME, self.SECOND_PROJECT_NAME] + ) + for project in projects: + try: + sa.delete_project(project=project["id"]) + except Exception as _: + pass class TestSettings(BaseTestCase): diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.py index f95fd8e7..55dc8ab7 100644 --- a/tests/integration/test_cli.py +++ b/tests/integration/test_cli.py @@ -37,9 +37,12 @@ def setUp(self, *args, **kwargs): self.tearDown() def tearDown(self) -> None: - projects = sa.search_projects(self.PROJECT_NAME, return_metadata=True) + projects = sa.list_projects(name__in=[self.PROJECT_NAME]) for project in projects: - sa.delete_project(project) + try: + sa.delete_project(project=project["id"]) + except Exception as _: + pass @property def convertor_data_path(self): diff --git a/tests/integration/test_depricated_functions_document.py b/tests/integration/test_depricated_functions_document.py index f61c603e..46bc0d0c 100644 --- a/tests/integration/test_depricated_functions_document.py +++ b/tests/integration/test_depricated_functions_document.py @@ -40,13 +40,12 @@ def setUp(self, *args, **kwargs): ) def tearDown(self) -> None: - projects = sa.search_projects(self.PROJECT_NAME, return_metadata=True) + projects = sa.list_projects(name__in=[self.PROJECT_NAME, self.PROJECT_NAME_2]) for project in projects: - sa.delete_project(project) - - projects = sa.search_projects(self.PROJECT_NAME_2, return_metadata=True) - for project in projects: - sa.delete_project(project) + try: + sa.delete_project(project=project["id"]) + except Exception as _: + pass @property def video_export_path(self): diff --git a/tests/integration/test_depricated_functions_video.py b/tests/integration/test_depricated_functions_video.py index a60926f2..02fb3f80 100644 --- a/tests/integration/test_depricated_functions_video.py +++ b/tests/integration/test_depricated_functions_video.py @@ -38,10 +38,12 @@ def setUp(self, *args, **kwargs): ) def tearDown(self) -> None: - projects = sa.search_projects(self.PROJECT_NAME, return_metadata=True) - projects.extend(sa.search_projects(self.PROJECT_NAME_2, return_metadata=True)) + projects = sa.list_projects(name__in=[self.PROJECT_NAME, self.PROJECT_NAME_2]) for project in projects: - sa.delete_project(project) + try: + sa.delete_project(project=project["id"]) + except Exception as _: + pass @property def video_export_path(self): diff --git a/tests/integration/test_video.py b/tests/integration/test_video.py index e47000a0..6ff1e0bf 100644 --- a/tests/integration/test_video.py +++ b/tests/integration/test_video.py @@ -45,10 +45,14 @@ def setUp(self, *args, **kwargs): ) def tearDown(self) -> None: - for project_name in (self.PROJECT_NAME, self.SECOND_PROJECT_NAME): - projects = sa.search_projects(project_name, return_metadata=True) - for project in projects: - sa.delete_project(project) + projects = sa.list_projects( + name__in=[self.PROJECT_NAME, self.SECOND_PROJECT_NAME] + ) + for project in projects: + try: + sa.delete_project(project=project["id"]) + except Exception as _: + pass def test_videos_upload_from_folder(self): res = sa.upload_videos_from_folder_to_project( diff --git a/tests/integration/tiled_project/test_tiled_project.py b/tests/integration/tiled_project/test_tiled_project.py deleted file mode 100644 index 12517fa9..00000000 --- a/tests/integration/tiled_project/test_tiled_project.py +++ /dev/null @@ -1,14 +0,0 @@ -from src.superannotate import SAClient -from tests.integration.base import BaseTestCase - -sa = SAClient() - - -class TestTiledProject(BaseTestCase): - PROJECT_NAME = "TestGetIntegrations" - PROJECT_DESCRIPTION = "desc" - PROJECT_TYPE = "Tiled" - - def test_get_metadata(self): - self._attach_items() - assert all(i["metadata"]["name"] for i in sa.get_annotations(self.PROJECT_NAME)) diff --git a/tests/integration/work_management/test_contributors_categories.py b/tests/integration/work_management/test_contributors_categories.py index fdeb82a9..313ef841 100644 --- a/tests/integration/work_management/test_contributors_categories.py +++ b/tests/integration/work_management/test_contributors_categories.py @@ -74,11 +74,11 @@ def setUpClass(cls, *args, **kwargs) -> None: @classmethod def tearDownClass(cls) -> None: - projects = sa.search_projects(cls.PROJECT_NAME, return_metadata=True) + projects = sa.list_projects(name__in=[cls.PROJECT_NAME]) for project in projects: try: - sa.delete_project(project) - except Exception: + sa.delete_project(project=project["id"]) + except Exception as _: pass def tearDown(self): diff --git a/tests/integration/work_management/test_project_categories.py b/tests/integration/work_management/test_project_categories.py index 1d873de7..7b86b745 100644 --- a/tests/integration/work_management/test_project_categories.py +++ b/tests/integration/work_management/test_project_categories.py @@ -67,11 +67,11 @@ def setUpClass(cls, *args, **kwargs) -> None: @classmethod def tearDownClass(cls) -> None: # cleanup test scores and project - projects = sa.search_projects(cls.PROJECT_NAME, return_metadata=True) + projects = sa.list_projects(name__in=[cls.PROJECT_NAME]) for project in projects: try: - sa.delete_project(project) - except Exception: + sa.delete_project(project=project["id"]) + except Exception as _: pass def test_project_categories_flow(self): diff --git a/tests/integration/work_management/test_project_user_permissions.py b/tests/integration/work_management/test_project_user_permissions.py index ed0f044a..0a3593db 100644 --- a/tests/integration/work_management/test_project_user_permissions.py +++ b/tests/integration/work_management/test_project_user_permissions.py @@ -29,11 +29,11 @@ def setUpClass(cls, *args, **kwargs) -> None: @classmethod def tearDownClass(cls) -> None: - projects = sa.search_projects(cls.PROJECT_NAME, return_metadata=True) + projects = sa.list_projects(name__in=[cls.PROJECT_NAME]) for project in projects: try: - sa.delete_project(project) - except Exception: + sa.delete_project(project=project["id"]) + except Exception as _: pass def tearDown(self): diff --git a/tests/integration/work_management/test_user_scoring.py b/tests/integration/work_management/test_user_scoring.py index fee2a237..3363d44e 100644 --- a/tests/integration/work_management/test_user_scoring.py +++ b/tests/integration/work_management/test_user_scoring.py @@ -91,11 +91,11 @@ def setUpClass(cls, *args, **kwargs) -> None: @classmethod def tearDownClass(cls) -> None: # cleanup test scores and project - projects = sa.search_projects(cls.PROJECT_NAME, return_metadata=True) + projects = sa.list_projects(name__in=[cls.PROJECT_NAME]) for project in projects: try: - sa.delete_project(project) - except Exception: + sa.delete_project(project=project["id"]) + except Exception as _: pass score_templates_name_id_map = { From e567283fc22ca5912c3888c6d0c9b433965fd241 Mon Sep 17 00:00:00 2001 From: "Dr. Q and Company" <213266729+drQedwards@users.noreply.github.com> Date: Tue, 9 Jun 2026 16:30:38 -0400 Subject: [PATCH 3/3] Revert "depricate PointCloud/Tiled fix tests" --- .../lib/app/interface/sdk_interface.py | 4 +++- .../aggregations/test_df_processing.py | 3 +-- tests/integration/export/test_export.py | 4 ++-- .../integration/items/test_attach_category.py | 6 +++--- tests/integration/items/test_generate_items.py | 5 ++--- .../mixpanel/test_mixpanel_decorator.py | 4 ++-- .../projects/test_create_project.py | 9 +-------- .../projects/test_project_rename.py | 15 +++++++-------- .../projects/test_search_project.py | 18 ++++++++++-------- tests/integration/settings/test_settings.py | 18 ++++++++++-------- tests/integration/test_cli.py | 7 ++----- .../test_depricated_functions_document.py | 11 ++++++----- .../test_depricated_functions_video.py | 8 +++----- tests/integration/test_video.py | 12 ++++-------- .../tiled_project/test_tiled_project.py | 14 ++++++++++++++ .../test_contributors_categories.py | 6 +++--- .../work_management/test_project_categories.py | 6 +++--- .../test_project_user_permissions.py | 6 +++--- .../work_management/test_user_scoring.py | 6 +++--- 19 files changed, 82 insertions(+), 80 deletions(-) create mode 100644 tests/integration/tiled_project/test_tiled_project.py diff --git a/src/superannotate/lib/app/interface/sdk_interface.py b/src/superannotate/lib/app/interface/sdk_interface.py index ee940303..3a9387e2 100644 --- a/src/superannotate/lib/app/interface/sdk_interface.py +++ b/src/superannotate/lib/app/interface/sdk_interface.py @@ -96,6 +96,8 @@ "Vector", "Video", "Document", + "Tiled", + "PointCloud", "Multimodal", ] @@ -1407,7 +1409,7 @@ def create_project( :param project_description: The new project's description. :type project_description: str - :param project_type: The project type. Supported types: 'Vector', 'Video', 'Document', 'Multimodal'. + :param project_type: The project type. Supported types: 'Vector', 'Video', 'Document', 'Tiled', 'PointCloud', 'Multimodal'. :type project_type: str :param settings: list of settings objects diff --git a/tests/integration/aggregations/test_df_processing.py b/tests/integration/aggregations/test_df_processing.py index b401351d..321b1379 100644 --- a/tests/integration/aggregations/test_df_processing.py +++ b/tests/integration/aggregations/test_df_processing.py @@ -30,8 +30,7 @@ def test_filter_instances(self): def test_invalid_project_type(self): with self.assertRaisesRegex( - AppException, - "Input should be 'Vector', 'Video', 'Document' or 'Multimodal'", + AppException, "The function is not supported for PointCloud projects." ): sa.aggregate_annotations_as_df(self.folder_path, "PointCloud") diff --git a/tests/integration/export/test_export.py b/tests/integration/export/test_export.py index 25ddb215..b97c844e 100644 --- a/tests/integration/export/test_export.py +++ b/tests/integration/export/test_export.py @@ -65,10 +65,10 @@ def setUpClass(cls) -> None: @classmethod def tearDownClass(cls) -> None: - projects = sa.list_projects(name=cls.PROJECT_NAME) + projects = sa.search_projects(cls.PROJECT_NAME, return_metadata=True) for project in projects: try: - sa.delete_project(project=project["id"]) + sa.delete_project(project) except AppException as e: logging.error(e) diff --git a/tests/integration/items/test_attach_category.py b/tests/integration/items/test_attach_category.py index 965be340..4515be1c 100644 --- a/tests/integration/items/test_attach_category.py +++ b/tests/integration/items/test_attach_category.py @@ -66,11 +66,11 @@ def setUpClass(cls, *args, **kwargs) -> None: @classmethod def tearDownClass(cls) -> None: # cleanup test scores and project - projects = sa.list_projects(name__in=[cls.PROJECT_NAME]) + projects = sa.search_projects(cls.PROJECT_NAME, return_metadata=True) for project in projects: try: - sa.delete_project(project=project["id"]) - except Exception as _: + sa.delete_project(project) + except Exception: pass @staticmethod diff --git a/tests/integration/items/test_generate_items.py b/tests/integration/items/test_generate_items.py index 352c80e8..9f895bab 100644 --- a/tests/integration/items/test_generate_items.py +++ b/tests/integration/items/test_generate_items.py @@ -27,7 +27,6 @@ class TestGenerateItemsMM(TestCase): } def setUp(self, *args, **kwargs): - self.tearDown() sa.create_project( self.PROJECT_NAME, self.PROJECT_DESCRIPTION, @@ -38,10 +37,10 @@ def setUp(self, *args, **kwargs): def tearDown(self) -> None: try: - projects = sa.list_projects(name=self.PROJECT_NAME) + projects = sa.search_projects(self.PROJECT_NAME, return_metadata=True) for project in projects: try: - sa.delete_project(project=project["id"]) + sa.delete_project(project) except Exception as e: print(str(e)) except Exception as e: diff --git a/tests/integration/mixpanel/test_mixpanel_decorator.py b/tests/integration/mixpanel/test_mixpanel_decorator.py index 855bf3c4..52f96614 100644 --- a/tests/integration/mixpanel/test_mixpanel_decorator.py +++ b/tests/integration/mixpanel/test_mixpanel_decorator.py @@ -44,10 +44,10 @@ def tearDownClass(cls) -> None: @classmethod def _safe_delete_project(cls, project_name): - projects = sa.list_projects(name=project_name) + projects = sa.search_projects(project_name, return_metadata=True) for project in projects: try: - sa.delete_project(project=project["id"]) + sa.delete_project(project) except Exception: raise diff --git a/tests/integration/projects/test_create_project.py b/tests/integration/projects/test_create_project.py index 5dcf04a6..ef5e604b 100644 --- a/tests/integration/projects/test_create_project.py +++ b/tests/integration/projects/test_create_project.py @@ -95,7 +95,7 @@ def test_create_project_datetime(self): def test_create_project_with_wrong_type(self): with self.assertRaisesRegex( AppException, - "Input should be 'Vector', 'Video', 'Document' or 'Multimodal'", + "Input should be 'Vector', 'Video', 'Document', 'Tiled', 'PointCloud' or 'Multimodal'", ): sa.create_project(self.PROJECT, "desc", "wrong_type") @@ -130,13 +130,6 @@ def test_create_project_with_classes_and_workflows(self): assert steps[1]["attribute"][0]["attribute"]["name"] == "Track" assert steps[1]["attribute"][1]["attribute"]["name"] == "Bus" - def test_deprecated_project_crate(self): - error_msg = "Input should be 'Vector', 'Video', 'Document' or 'Multimodal'" - with self.assertRaisesRegex(AppException, error_msg): - sa.create_project(self.PROJECT, "desc", "Tiled") - with self.assertRaisesRegex(AppException, error_msg): - sa.create_project(self.PROJECT, "desc", "PointCloud") - class TestCreateVideoProject(ProjectCreateBaseTestCase): PROJECT = "test_video_project" diff --git a/tests/integration/projects/test_project_rename.py b/tests/integration/projects/test_project_rename.py index 1a58068a..d63eebed 100644 --- a/tests/integration/projects/test_project_rename.py +++ b/tests/integration/projects/test_project_rename.py @@ -20,17 +20,16 @@ def setUp(self, *args, **kwargs): ) def tearDown(self) -> None: - projects = sa.list_projects( - name__in=[ - self.PROJECT_NAME, - self.NEW_PROJECT_NAME, - self.REPLACED_PROJECT_NAME, - self.NAME_TO_RENAME, - ] + projects = [] + projects.extend(sa.search_projects(self.PROJECT_NAME, return_metadata=True)) + projects.extend(sa.search_projects(self.NEW_PROJECT_NAME, return_metadata=True)) + projects.extend( + sa.search_projects(self.REPLACED_PROJECT_NAME, return_metadata=True) ) + projects.extend(sa.search_projects(self.NAME_TO_RENAME, return_metadata=True)) for project in projects: try: - sa.delete_project(project=project["id"]) + sa.delete_project(project) except Exception as _: pass diff --git a/tests/integration/projects/test_search_project.py b/tests/integration/projects/test_search_project.py index 3a903633..f9673606 100644 --- a/tests/integration/projects/test_search_project.py +++ b/tests/integration/projects/test_search_project.py @@ -22,17 +22,19 @@ def setUp(self, *args, **kwargs): ) def tearDown(self) -> None: - projects = sa.list_projects( - name__in=[ - self.PROJECT_NAME, - self.PROJECT_NAME_2, - self.REPLACED_PROJECT_NAME, - self.PROJECT_NAME_CONTAIN_SPECIAL_CHARACTER, - ] + projects = [] + projects.extend(sa.search_projects(self.PROJECT_NAME, return_metadata=True)) + projects.extend( + sa.search_projects(self.REPLACED_PROJECT_NAME, return_metadata=True) + ) + projects.extend( + sa.search_projects( + self.PROJECT_NAME_CONTAIN_SPECIAL_CHARACTER, return_metadata=True + ) ) for project in projects: try: - sa.delete_project(project=project["id"]) + sa.delete_project(project) except Exception as _: pass diff --git a/tests/integration/settings/test_settings.py b/tests/integration/settings/test_settings.py index 60abbff9..8fc9ee14 100644 --- a/tests/integration/settings/test_settings.py +++ b/tests/integration/settings/test_settings.py @@ -15,14 +15,16 @@ def setUp(self) -> None: self.tearDown() def tearDown(self) -> None: - projects = sa.list_projects( - name__in=[self.PROJECT_NAME, self.SECOND_PROJECT_NAME] - ) - for project in projects: - try: - sa.delete_project(project=project["id"]) - except Exception as _: - pass + try: + 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=project["id"]) + except Exception: + pass + except Exception as e: + print(str(e)) class TestSettings(BaseTestCase): diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.py index 55dc8ab7..f95fd8e7 100644 --- a/tests/integration/test_cli.py +++ b/tests/integration/test_cli.py @@ -37,12 +37,9 @@ def setUp(self, *args, **kwargs): self.tearDown() def tearDown(self) -> None: - projects = sa.list_projects(name__in=[self.PROJECT_NAME]) + projects = sa.search_projects(self.PROJECT_NAME, return_metadata=True) for project in projects: - try: - sa.delete_project(project=project["id"]) - except Exception as _: - pass + sa.delete_project(project) @property def convertor_data_path(self): diff --git a/tests/integration/test_depricated_functions_document.py b/tests/integration/test_depricated_functions_document.py index 46bc0d0c..f61c603e 100644 --- a/tests/integration/test_depricated_functions_document.py +++ b/tests/integration/test_depricated_functions_document.py @@ -40,12 +40,13 @@ def setUp(self, *args, **kwargs): ) def tearDown(self) -> None: - projects = sa.list_projects(name__in=[self.PROJECT_NAME, self.PROJECT_NAME_2]) + projects = sa.search_projects(self.PROJECT_NAME, return_metadata=True) for project in projects: - try: - sa.delete_project(project=project["id"]) - except Exception as _: - pass + sa.delete_project(project) + + projects = sa.search_projects(self.PROJECT_NAME_2, return_metadata=True) + for project in projects: + sa.delete_project(project) @property def video_export_path(self): diff --git a/tests/integration/test_depricated_functions_video.py b/tests/integration/test_depricated_functions_video.py index 02fb3f80..a60926f2 100644 --- a/tests/integration/test_depricated_functions_video.py +++ b/tests/integration/test_depricated_functions_video.py @@ -38,12 +38,10 @@ def setUp(self, *args, **kwargs): ) def tearDown(self) -> None: - projects = sa.list_projects(name__in=[self.PROJECT_NAME, self.PROJECT_NAME_2]) + projects = sa.search_projects(self.PROJECT_NAME, return_metadata=True) + projects.extend(sa.search_projects(self.PROJECT_NAME_2, return_metadata=True)) for project in projects: - try: - sa.delete_project(project=project["id"]) - except Exception as _: - pass + sa.delete_project(project) @property def video_export_path(self): diff --git a/tests/integration/test_video.py b/tests/integration/test_video.py index 6ff1e0bf..e47000a0 100644 --- a/tests/integration/test_video.py +++ b/tests/integration/test_video.py @@ -45,14 +45,10 @@ def setUp(self, *args, **kwargs): ) def tearDown(self) -> None: - projects = sa.list_projects( - name__in=[self.PROJECT_NAME, self.SECOND_PROJECT_NAME] - ) - for project in projects: - try: - sa.delete_project(project=project["id"]) - except Exception as _: - pass + for project_name in (self.PROJECT_NAME, self.SECOND_PROJECT_NAME): + projects = sa.search_projects(project_name, return_metadata=True) + for project in projects: + sa.delete_project(project) def test_videos_upload_from_folder(self): res = sa.upload_videos_from_folder_to_project( diff --git a/tests/integration/tiled_project/test_tiled_project.py b/tests/integration/tiled_project/test_tiled_project.py new file mode 100644 index 00000000..12517fa9 --- /dev/null +++ b/tests/integration/tiled_project/test_tiled_project.py @@ -0,0 +1,14 @@ +from src.superannotate import SAClient +from tests.integration.base import BaseTestCase + +sa = SAClient() + + +class TestTiledProject(BaseTestCase): + PROJECT_NAME = "TestGetIntegrations" + PROJECT_DESCRIPTION = "desc" + PROJECT_TYPE = "Tiled" + + def test_get_metadata(self): + self._attach_items() + assert all(i["metadata"]["name"] for i in sa.get_annotations(self.PROJECT_NAME)) diff --git a/tests/integration/work_management/test_contributors_categories.py b/tests/integration/work_management/test_contributors_categories.py index 313ef841..fdeb82a9 100644 --- a/tests/integration/work_management/test_contributors_categories.py +++ b/tests/integration/work_management/test_contributors_categories.py @@ -74,11 +74,11 @@ def setUpClass(cls, *args, **kwargs) -> None: @classmethod def tearDownClass(cls) -> None: - projects = sa.list_projects(name__in=[cls.PROJECT_NAME]) + projects = sa.search_projects(cls.PROJECT_NAME, return_metadata=True) for project in projects: try: - sa.delete_project(project=project["id"]) - except Exception as _: + sa.delete_project(project) + except Exception: pass def tearDown(self): diff --git a/tests/integration/work_management/test_project_categories.py b/tests/integration/work_management/test_project_categories.py index 7b86b745..1d873de7 100644 --- a/tests/integration/work_management/test_project_categories.py +++ b/tests/integration/work_management/test_project_categories.py @@ -67,11 +67,11 @@ def setUpClass(cls, *args, **kwargs) -> None: @classmethod def tearDownClass(cls) -> None: # cleanup test scores and project - projects = sa.list_projects(name__in=[cls.PROJECT_NAME]) + projects = sa.search_projects(cls.PROJECT_NAME, return_metadata=True) for project in projects: try: - sa.delete_project(project=project["id"]) - except Exception as _: + sa.delete_project(project) + except Exception: pass def test_project_categories_flow(self): diff --git a/tests/integration/work_management/test_project_user_permissions.py b/tests/integration/work_management/test_project_user_permissions.py index 0a3593db..ed0f044a 100644 --- a/tests/integration/work_management/test_project_user_permissions.py +++ b/tests/integration/work_management/test_project_user_permissions.py @@ -29,11 +29,11 @@ def setUpClass(cls, *args, **kwargs) -> None: @classmethod def tearDownClass(cls) -> None: - projects = sa.list_projects(name__in=[cls.PROJECT_NAME]) + projects = sa.search_projects(cls.PROJECT_NAME, return_metadata=True) for project in projects: try: - sa.delete_project(project=project["id"]) - except Exception as _: + sa.delete_project(project) + except Exception: pass def tearDown(self): diff --git a/tests/integration/work_management/test_user_scoring.py b/tests/integration/work_management/test_user_scoring.py index 3363d44e..fee2a237 100644 --- a/tests/integration/work_management/test_user_scoring.py +++ b/tests/integration/work_management/test_user_scoring.py @@ -91,11 +91,11 @@ def setUpClass(cls, *args, **kwargs) -> None: @classmethod def tearDownClass(cls) -> None: # cleanup test scores and project - projects = sa.list_projects(name__in=[cls.PROJECT_NAME]) + projects = sa.search_projects(cls.PROJECT_NAME, return_metadata=True) for project in projects: try: - sa.delete_project(project=project["id"]) - except Exception as _: + sa.delete_project(project) + except Exception: pass score_templates_name_id_map = {