Skip to content

Commit 860cf01

Browse files
Narek MkhitaryanNarek Mkhitaryan
authored andcommitted
add test pixel project blue mask
1 parent 1049fbb commit 860cf01

File tree

5 files changed

+48
-0
lines changed

5 files changed

+48
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"id": 4991071, "project_id": 533166, "name": "cat3", "color": "#d08e91", "count": 0, "type": "object", "createdAt": "2023-07-20T12:58:35.000Z", "updatedAt": "2023-07-20T12:58:35.000Z", "attribute_groups": []}, {"id": 4991070, "project_id": 533166, "name": "cat2", "color": "#1c09ea", "count": 0, "type": "object", "createdAt": "2023-07-20T12:58:30.000Z", "updatedAt": "2023-07-20T12:58:30.000Z", "attribute_groups": []}, {"id": 4991069, "project_id": 533166, "name": "cat 1", "color": "#e23787", "count": 0, "type": "object", "createdAt": "2023-07-20T12:58:24.000Z", "updatedAt": "2023-07-20T12:58:24.000Z", "attribute_groups": []}]
159 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"metadata": {"height": 560, "width": 1440, "name": "Hero Pedigree Cats.jpg", "lastAction": {"email": "narekm@superannotate.com", "timestamp": 1689857925400}, "projectId": 533166, "isPredicted": false, "isSegmented": false, "status": "Completed", "pinned": false, "annotatorEmail": null, "qaEmail": null}, "instances": [{"classId": 4991070, "probability": 100, "visible": true, "attributes": [], "parts": [{"color": "#00005a"}], "error": null, "locked": false, "createdAt": "2023-07-20T12:59:49.061Z", "createdBy": {"email": "narekm@superannotate.com", "role": "Admin"}, "creationType": "Manual", "updatedAt": "2023-07-20T13:00:00.234Z", "updatedBy": {"email": "narekm@superannotate.com", "role": "Admin"}, "className": "cat2"}, {"classId": 4991069, "probability": 100, "visible": true, "attributes": [], "parts": [{"color": "#00000f"}, {"color": "#00001e"}, {"color": "#00002d"}, {"color": "#00003c"}], "error": null, "locked": false, "createdAt": "2023-07-20T12:59:02.464Z", "createdBy": {"email": "narekm@superannotate.com", "role": "Admin"}, "creationType": "Manual", "updatedAt": "2023-07-20T12:59:38.786Z", "updatedBy": {"email": "narekm@superannotate.com", "role": "Admin"}, "className": "cat 1"}], "comments": [], "tags": []}
23 KB
Loading

tests/integration/annotations/test_upload_annotations_from_folder_to_project.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import tempfile
23
from pathlib import Path
34

45
from src.superannotate import SAClient
@@ -122,3 +123,48 @@ def test_annotation_folder_upload_download(self):
122123
self.PROJECT_NAME, self.folder_path
123124
)
124125
assert len(uploaded) == 1
126+
127+
128+
class TestExportUploadPixel(BaseTestCase):
129+
PROJECT_NAME = "Test-TestExportUploadPixel"
130+
PROJECT_DESCRIPTION = "Desc"
131+
PROJECT_TYPE = "PIXEL"
132+
TEST_FOLDER_PATH = "data_set/sample_explore_export_pixel"
133+
ITEM_NAME = "file_example.jpg"
134+
135+
@property
136+
def data_set(self):
137+
return Path(__file__).parent.parent.parent
138+
139+
@property
140+
def folder_path(self):
141+
return os.path.join(Path(__file__).parent.parent.parent, self.TEST_FOLDER_PATH)
142+
143+
def test_annotation_folder_upload_download(self):
144+
with tempfile.TemporaryDirectory() as tmpdir:
145+
sa.attach_items(
146+
self.PROJECT_NAME,
147+
[{"name": self.ITEM_NAME, "url": "url_"}],
148+
)
149+
sa.create_annotation_classes_from_classes_json(
150+
self.PROJECT_NAME, f"{self.folder_path}/classes/classes.json"
151+
)
152+
uploaded, _, _ = sa.upload_annotations_from_folder_to_project(
153+
self.PROJECT_NAME, self.folder_path
154+
)
155+
assert len(uploaded) == 1
156+
export_name = sa.prepare_export(self.PROJECT_NAME)["name"]
157+
sa.download_export(
158+
project=self.PROJECT_NAME, export=export_name, folder_path=tmpdir
159+
)
160+
list_dir = os.listdir(tmpdir)
161+
assert f"{self.ITEM_NAME}___save.png" in list_dir
162+
assert f"{self.ITEM_NAME}.json" in list_dir
163+
assert "classes" in list_dir
164+
165+
with open(f"{tmpdir}/{self.ITEM_NAME}___save.png", "rb") as f1, open(
166+
f"{self.folder_path}/{self.ITEM_NAME}___save.png", "rb"
167+
) as f2:
168+
contents1 = f1.read()
169+
contents2 = f2.read()
170+
assert contents1 == contents2

0 commit comments

Comments
 (0)