Skip to content

Commit ee8fff2

Browse files
committed
Fix missing name test
1 parent 09a4f10 commit ee8fff2

File tree

4 files changed

+15
-33
lines changed

4 files changed

+15
-33
lines changed

superannotate/db/annotation_classes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@ def fill_class_and_attribute_ids(annotation_json, annotation_classes_dict):
350350

351351
def check_annotation_json(annotation_json):
352352
if "metadata" not in annotation_json or "width" not in annotation_json[
353-
"metadata"] or "height" not in annotation_json["metadata"]:
353+
"metadata"] or "height" not in annotation_json[
354+
"metadata"] or "name" not in annotation_json["metadata"]:
354355
return False
355356
else:
356357
return True

superannotate/db/projects.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,6 @@ def __upload_annotations_thread(
11031103
annotation_classes_dict, thread_id, chunksize, missing_images,
11041104
couldnt_upload, uploaded, from_s3_bucket
11051105
):
1106-
print("DEBUG")
11071106
NUM_TO_SEND = 500
11081107
len_anns = len(anns_filenames)
11091108
start_index = thread_id * chunksize
@@ -1120,7 +1119,6 @@ def __upload_annotations_thread(
11201119

11211120
for i in range(start_index, end_index, NUM_TO_SEND):
11221121
data = {"project_id": project_id, "team_id": team_id, "names": []}
1123-
print("DEBUG", flush=True)
11241122
for j in range(i, i + NUM_TO_SEND):
11251123
if j >= end_index:
11261124
break

tests/sample_project_vector_for_checks/example_image_2.jpg___objects.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"metadata": {
3-
"name": "example_image_2.jpg",
43
"width": 1885,
54
"height": 1060,
65
"status": "Completed",

tests/test_missing_annotation_upload.py

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import superannotate as sa
44

5+
56
def test_missing_annotation_upload(tmpdir):
67
name = "Example Project test vector missing annotation upload"
78
project_type = "Vector"
@@ -23,22 +24,14 @@ def test_missing_annotation_upload(tmpdir):
2324
project, from_folder
2425
)
2526
print(uploaded, couldnt_upload, missing_images)
26-
assert len(uploaded) == 2
27-
assert len(couldnt_upload) == 1
27+
assert len(uploaded) == 1
28+
assert len(couldnt_upload) == 2
2829
assert len(missing_images) == 1
2930

30-
assert uploaded[
31-
0
32-
] == "tests/sample_project_vector_for_checks/example_image_1.jpg___objects.json"
33-
assert uploaded[
34-
1
35-
] == "tests/sample_project_vector_for_checks/example_image_2.jpg___objects.json"
36-
assert couldnt_upload[
37-
0
38-
] == "tests/sample_project_vector_for_checks/example_image_4.jpg___objects.json"
39-
assert missing_images[
40-
0
41-
] == "tests/sample_project_vector_for_checks/example_image_5.jpg___objects.json"
31+
assert "tests/sample_project_vector_for_checks/example_image_1.jpg___objects.json" in uploaded
32+
assert "tests/sample_project_vector_for_checks/example_image_2.jpg___objects.json" in couldnt_upload
33+
assert "tests/sample_project_vector_for_checks/example_image_4.jpg___objects.json" in couldnt_upload
34+
assert "tests/sample_project_vector_for_checks/example_image_5.jpg___objects.json" in missing_images
4235

4336

4437
def test_missing_preannotation_upload(tmpdir):
@@ -47,7 +40,6 @@ def test_missing_preannotation_upload(tmpdir):
4740
description = "test vector"
4841
from_folder = Path("./tests/sample_project_vector_for_checks")
4942

50-
5143
projects = sa.search_projects(name, return_metadata=True)
5244
for project in projects:
5345
sa.delete_project(project)
@@ -64,18 +56,10 @@ def test_missing_preannotation_upload(tmpdir):
6456
project, from_folder
6557
)
6658
print(uploaded, couldnt_upload)
67-
assert len(uploaded) == 3
68-
assert len(couldnt_upload) == 1
59+
assert len(uploaded) == 2
60+
assert len(couldnt_upload) == 2
6961

70-
assert uploaded[
71-
0
72-
] == "tests/sample_project_vector_for_checks/example_image_1.jpg___objects.json"
73-
assert uploaded[
74-
1
75-
] == "tests/sample_project_vector_for_checks/example_image_2.jpg___objects.json"
76-
assert uploaded[
77-
2
78-
] == "tests/sample_project_vector_for_checks/example_image_5.jpg___objects.json"
79-
assert couldnt_upload[
80-
0
81-
] == "tests/sample_project_vector_for_checks/example_image_4.jpg___objects.json"
62+
assert "tests/sample_project_vector_for_checks/example_image_1.jpg___objects.json" in uploaded
63+
assert "tests/sample_project_vector_for_checks/example_image_5.jpg___objects.json" in uploaded
64+
assert "tests/sample_project_vector_for_checks/example_image_2.jpg___objects.json" in couldnt_upload
65+
assert "tests/sample_project_vector_for_checks/example_image_4.jpg___objects.json" in couldnt_upload

0 commit comments

Comments
 (0)