Skip to content

Commit 51a1edb

Browse files
committed
Tests update
1 parent 2c071df commit 51a1edb

File tree

4 files changed

+7
-45
lines changed

4 files changed

+7
-45
lines changed

src/superannotate/lib/core/serviceproviders.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -331,15 +331,6 @@ async def list_small_annotations(
331331
) -> List[dict]:
332332
raise NotImplementedError
333333

334-
@abstractmethod
335-
def sort_items_by_size(
336-
self,
337-
project: entities.ProjectEntity,
338-
folder: entities.FolderEntity,
339-
item_ids: List[int],
340-
) -> Dict[str, List]:
341-
raise NotImplementedError
342-
343334
@abstractmethod
344335
def get_upload_chunks(
345336
self,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,6 @@ def execute(self):
17371737
)
17381738
)
17391739
except Exception as e:
1740-
raise e
17411740
logger.error(e)
17421741
self._response.errors = AppException("Can't get annotations.")
17431742
return self._response

src/superannotate/lib/infrastructure/services/annotation.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -153,35 +153,6 @@ async def list_small_annotations(
153153
params=query_params,
154154
)
155155

156-
def sort_items_by_size(
157-
self,
158-
project: entities.ProjectEntity,
159-
folder: entities.FolderEntity,
160-
item_ids: List[int],
161-
) -> Dict[str, List]:
162-
chunk_size = 2000
163-
query_params = {
164-
"project_id": project.id,
165-
"folder_id": folder.id,
166-
}
167-
168-
response_data = {"small": [], "large": []}
169-
for i in range(0, len(item_ids), chunk_size):
170-
body = {
171-
"item_ids": item_ids[i : i + chunk_size], # noqa
172-
} # noqa
173-
response = self.client.request(
174-
url=urljoin(self.assets_provider_url, self.URL_CLASSIFY_ITEM_SIZE),
175-
method="POST",
176-
params=query_params,
177-
data=body,
178-
)
179-
if not response.ok:
180-
raise AppException(response.error)
181-
response_data["small"].extend(response.data.get("small", []))
182-
response_data["large"].extend(response.data.get("large", []))
183-
return response_data
184-
185156
def get_upload_chunks(
186157
self,
187158
project: entities.ProjectEntity,

tests/unit/test_async_functions.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from superannotate import SAClient
55

6-
76
sa = SAClient()
87

98

@@ -58,24 +57,26 @@ async def _test():
5857
asyncio.run(_test())
5958

6059
def test_create_task_get_annotations_in_running_event_loop(self):
61-
async def _test():
62-
task1 = asyncio.create_task(self.nested())
63-
task2 = asyncio.create_task(self.nested())
64-
await task1
65-
await task2
60+
async def _test():
61+
task1 = asyncio.create_task(self.nested())
62+
task2 = asyncio.create_task(self.nested())
63+
await task1
64+
await task2
6665

6766
asyncio.run(_test())
6867

6968
def test_gather_get_annotations_in_running_event_loop(self):
7069
async def gather_test():
7170
await asyncio.gather(self.nested(), self.nested())
71+
7272
asyncio.run(gather_test())
7373

7474
def test_gather_async_for(self):
7575
async def gather_test():
7676
async for _ in DummyIterator(delay=0.01, to=2):
7777
annotations = sa.get_annotations(TestAsyncFunctions.PROJECT_NAME)
7878
assert len(annotations) == 4
79+
7980
asyncio.run(gather_test())
8081

8182
def test_upload_annotations_in_running_event_loop(self):

0 commit comments

Comments
 (0)