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
2 changes: 2 additions & 0 deletions src/superannotate/lib/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ def setup_logging(level=DEFAULT_LOGGING_LEVEL, file_path=LOG_FILE_LOCATION):
"TemplateState",
"CategorizeItems",
"MaxIdleDuration",
"ItemAutoAssignOrder",
"ImageAutoAssignByCategory",
]

__alL__ = (
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/projects/test_basic_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class BaseMultimodalProjectCreate(TestCase):
"readme": "",
}
MULTIMODAL_FORM = None
SETTINGS = None

def setUp(self, *args, **kwargs):
self.tearDown()
Expand All @@ -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,
)

Expand Down
13 changes: 12 additions & 1 deletion tests/integration/projects/test_clone_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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(
Expand Down
29 changes: 17 additions & 12 deletions tests/integration/settings/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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