Skip to content

Commit 3bd03e4

Browse files
dshabinVaghinak Basentsyan
authored andcommitted
Add test for attributes
1 parent 0516cb0 commit 3bd03e4

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/superannotate/lib/app/interface/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@ def wrapped(*args, **kwargs):
8080
field, " " * (48 - len(field)), f"\n {' ' * 48}".join(text)
8181
)
8282
)
83-
raise Exception("\n".join(texts))
83+
raise Exception("\n".join(texts)) from None
8484

8585
return wrapped

tests/integration/test_annotation_upload_pixel.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import os
22
from os.path import dirname
33
import pytest
4-
54
import src.superannotate as sa
65
from tests.integration.base import BaseTestCase
7-
6+
import tempfile
7+
import json
8+
from os.path import join
89

910
class TestRecursiveFolderPixel(BaseTestCase):
1011
PROJECT_NAME = "test_recursive_pixel"
1112
PROJECT_DESCRIPTION = "Desc"
1213
PROJECT_TYPE = "Pixel"
1314
S3_FOLDER_PATH = "sample_project_pixel"
1415
TEST_FOLDER_PATH = "data_set/sample_project_pixel"
16+
IMAGE_NAME = "example_image_1.jpg"
1517

1618
@property
1719
def folder_path(self):
@@ -26,3 +28,16 @@ def test_recursive_annotation_upload_pixel(self):
2628
from_s3_bucket="superannotate-python-sdk-test",
2729
recursive_subfolders=False)
2830
self.assertEqual(len(uploaded_annotations), 3)
31+
32+
@pytest.mark.flaky(reruns=2)
33+
def test_annotation_upload_pixel(self):
34+
sa.upload_images_from_folder_to_project(self.PROJECT_NAME, self.folder_path)
35+
sa.upload_annotations_from_folder_to_project(self.PROJECT_NAME, self.folder_path)
36+
with tempfile.TemporaryDirectory() as tmp_dir:
37+
sa.download_image_annotations(self.PROJECT_NAME, self.IMAGE_NAME, tmp_dir)
38+
origin_annotation = json.load(open(f"{self.folder_path}/{self.IMAGE_NAME}___pixel.json"))
39+
annotation = json.load(open(join(tmp_dir, f"{self.IMAGE_NAME}___pixel.json")))
40+
self.assertEqual(
41+
[i["attributes"] for i in annotation["instances"]],
42+
[i["attributes"] for i in origin_annotation["instances"]]
43+
)

0 commit comments

Comments
 (0)