Skip to content

Commit b8ff51e

Browse files
committed
fix export
1 parent 56f729a commit b8ff51e

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

src/superannotate/lib/core/usecases/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def execute(self):
112112
integration_id=self._integration_id,
113113
)
114114
if self._annotation_statuses:
115-
kwargs["annotation_statuses"] = (self._annotation_statuses,)
115+
kwargs["annotation_statuses"] = self._annotation_statuses
116116
if self._export_type:
117117
kwargs["export_type"] = self._export_type
118118
response = self._service_provider.prepare_export(**kwargs)

tests/applicatoin/base.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
from unittest import TestCase
2+
3+
from src.superannotate import SAClient
4+
5+
6+
sa = SAClient()
7+
8+
9+
class BaseTestCase(TestCase):
10+
PROJECT_NAME = ""
11+
PROJECT_DESCRIPTION = "Desc"
12+
PROJECT_TYPE = "Vector"
13+
TEST_FOLDER_PATH = "data_set"
14+
15+
def __init__(self, *args, **kwargs):
16+
super().__init__(*args, **kwargs)
17+
BaseTestCase.PROJECT_NAME = BaseTestCase.__class__.__name__
18+
19+
def setUp(self, *args, **kwargs):
20+
self.tearDown()
21+
self._project = sa.create_project(
22+
self.PROJECT_NAME, self.PROJECT_DESCRIPTION, self.PROJECT_TYPE
23+
)
24+
25+
def tearDown(self) -> None:
26+
try:
27+
projects = sa.search_projects(self.PROJECT_NAME, return_metadata=True)
28+
for project in projects:
29+
try:
30+
sa.delete_project(project)
31+
except Exception as e:
32+
print(str(e))
33+
except Exception as e:
34+
print(str(e))
35+
36+
def _attach_items(self, count=5, folder=None):
37+
path = self.PROJECT_NAME
38+
if folder:
39+
path = f"{self.PROJECT_NAME}/{folder}"
40+
sa.attach_items(
41+
path,
42+
[
43+
{"name": f"example_image_{i}.jpg", "url": f"url_{i}"}
44+
for i in range(1, count + 1)
45+
], # noqa
46+
)

tests/integration/export/test_export.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,10 @@ def test_upload_s3(self):
111111
).get("Contents", []):
112112
files.append(object_data["Key"])
113113
self.assertEqual(25, len(files))
114+
115+
def test_export_with_statuses(self):
116+
with tempfile.TemporaryDirectory() as tmpdir_name:
117+
export = sa.prepare_export(self.PROJECT_NAME, annotation_statuses=['NotStarted'], include_fuse=True)
118+
sa.download_export(self.PROJECT_NAME, export, tmpdir_name)
119+
assert not filecmp.dircmp(tmpdir_name, self.TEST_FOLDER_PATH).left_only
120+
assert not filecmp.dircmp(tmpdir_name, self.TEST_FOLDER_PATH).right_only

0 commit comments

Comments
 (0)