Skip to content

Commit db35b4e

Browse files
Vaghinak BasentsyanVaghinak Basentsyan
authored andcommitted
tod
1 parent 1998e60 commit db35b4e

File tree

6 files changed

+18
-10
lines changed

6 files changed

+18
-10
lines changed

src/superannotate/lib/core/usecases.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,9 +2281,11 @@ def fill_classes_data(self, annotations: dict):
22812281
for annotation in (
22822282
i for i in annotations["instances"] if i.get("type", None) == "template"
22832283
):
2284-
annotation["templateName"] = templates.get(
2285-
annotation.get("templateId", ""), -1
2284+
template_name = templates.get(
2285+
annotation.get("templateId"), None
22862286
)
2287+
if template_name:
2288+
annotation["templateName"] = template_name
22872289

22882290
for annotation in [i for i in annotations["instances"] if "classId" in i]:
22892291
annotation_class_id = annotation["classId"]

tests/integration/base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ def setUp(self, *args, **kwargs):
2323
def tearDown(self) -> None:
2424
projects = sa.search_projects(self.PROJECT_NAME, return_metadata=True)
2525
for project in projects:
26-
sa.delete_project(project)
26+
try:
27+
sa.delete_project(project)
28+
except Exception:
29+
pass

tests/integration/test_attach_document_urls.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def test_attach_image_urls(self):
2020
self.assertEqual(len(could_not_upload), 0)
2121
self.assertEqual(len(existing_images), 1)
2222

23+
2324
class TestImageUrls(BaseTestCase):
2425
PROJECT_NAME = "test attach image urls"
2526
PATH_TO_URLS = "data_set/csv_files/text_urls.csv"
@@ -35,6 +36,7 @@ def test_attach_image_urls(self):
3536
self.assertEqual(len(could_not_upload), 0)
3637
self.assertEqual(len(existing_images), 1)
3738

39+
3840
class TestVideoUrls(BaseTestCase):
3941
PROJECT_NAME = "test attach video urls"
4042
PATH_TO_URLS = "data_set/csv_files/text_urls.csv"
@@ -48,4 +50,4 @@ def test_attach_image_urls(self):
4850
)
4951
self.assertEqual(len(uploaded), 11)
5052
self.assertEqual(len(could_not_upload), 0)
51-
self.assertEqual(len(existing_images), 1)
53+
self.assertEqual(len(existing_images), 1)

tests/integration/test_attach_image_urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def test_attach_image_urls(self):
2121

2222
self.assertEqual(UploadState.EXTERNAL.name, project_metadata["upload_state"])
2323

24-
self.assertEqual(len(uploaded), 8)
25-
self.assertEqual(len(could_not_upload), 1)
24+
self.assertEqual(len(uploaded), 7)
25+
self.assertEqual(len(could_not_upload), 0)
2626
self.assertEqual(len(existing_images), 1)
2727
images = sa.search_images(project=self.PROJECT_NAME, return_metadata=True)
2828
self.assertTrue(all([image["name"] for image in images]))

tests/integration/test_attach_video_urls.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ def test_attach_video_urls(self):
2525
self.PROJECT_NAME,
2626
self.csv_path,
2727
)
28-
self.assertEqual(len(uploaded), 8)
29-
self.assertEqual(len(could_not_upload), 1)
28+
self.assertEqual(len(uploaded), 7)
29+
self.assertEqual(len(could_not_upload), 0)
3030
self.assertEqual(len(existing_images), 1)
3131

3232
def test_attach_video_urls_without_name_column(self):
3333
uploaded, could_not_upload, existing_images = sa.attach_video_urls_to_project(
3434
self.PROJECT_NAME,
3535
self.csv_path_without_name_column
3636
)
37-
self.assertEqual(len(uploaded), 8)
38-
self.assertEqual(len(could_not_upload), 1)
37+
self.assertEqual(len(uploaded), 7)
38+
self.assertEqual(len(could_not_upload), 0)
3939
self.assertEqual(len(existing_images), 1)

tests/integration/test_single_annotation_download.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def test_annotation_download_upload_vector(self):
5454
for j in i["attributes"]:
5555
j.pop("groupId", None)
5656
j.pop("id", None)
57+
# TODO check teplateId -1 when
5758
assert downloaded_json == uploaded_json
5859

5960

0 commit comments

Comments
 (0)