Skip to content
Open
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
4 changes: 1 addition & 3 deletions src/superannotate/lib/app/interface/sdk_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@
"Vector",
"Video",
"Document",
"Tiled",
"PointCloud",
"Multimodal",
]

Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/aggregations/test_df_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/export/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions tests/integration/items/test_attach_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions tests/integration/items/test_generate_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class TestGenerateItemsMM(TestCase):
}

def setUp(self, *args, **kwargs):
self.tearDown()
sa.create_project(
self.PROJECT_NAME,
self.PROJECT_DESCRIPTION,
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/mixpanel/test_mixpanel_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 8 additions & 1 deletion tests/integration/projects/test_create_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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"
Expand Down
15 changes: 8 additions & 7 deletions tests/integration/projects/test_project_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 8 additions & 10 deletions tests/integration/projects/test_search_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 8 additions & 12 deletions tests/integration/settings/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
7 changes: 5 additions & 2 deletions tests/integration/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
11 changes: 5 additions & 6 deletions tests/integration/test_depricated_functions_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 5 additions & 3 deletions tests/integration/test_depricated_functions_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
12 changes: 8 additions & 4 deletions tests/integration/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
14 changes: 0 additions & 14 deletions tests/integration/tiled_project/test_tiled_project.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/work_management/test_project_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/work_management/test_user_scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down