Skip to content

Commit 64b5263

Browse files
committed
fix applied
1 parent 47bab9d commit 64b5263

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

tests/integration/test_export.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import uuid
2+
from labelbox.data.annotation_types.annotation import ObjectAnnotation
3+
4+
from labelbox.schema.annotation_import import LabelImport
5+
6+
7+
def test_export_annotations_nested_checklist(
8+
client, configured_project_with_complex_ontology):
9+
project, data_row = configured_project_with_complex_ontology
10+
ontology = project.ontology().normalized
11+
12+
tool = ontology["tools"][0]
13+
14+
nested_check = [
15+
subc for subc in tool["classifications"]
16+
if subc["name"] == "test-checklist-class"
17+
][0]
18+
19+
data = [{
20+
"uuid":
21+
str(uuid.uuid4()),
22+
"schemaId":
23+
tool['featureSchemaId'],
24+
"dataRow": {
25+
"id": data_row.uid
26+
},
27+
"bbox": {
28+
"top": 20,
29+
"left": 20,
30+
"height": 50,
31+
"width": 50
32+
},
33+
"classifications": [{
34+
"schemaId":
35+
nested_check["featureSchemaId"],
36+
"answers": [
37+
{
38+
"schemaId": nested_check["options"][0]["featureSchemaId"]
39+
},
40+
{
41+
"schemaId": nested_check["options"][1]["featureSchemaId"]
42+
},
43+
]
44+
}]
45+
}]
46+
47+
task = LabelImport.create_from_objects(client, project.uid,
48+
f'label-import-{uuid.uuid4()}',
49+
data)
50+
task.wait_until_done()
51+
labels = project.label_generator().as_list()
52+
object_annotation = [
53+
annot for annot in next(labels).annotations
54+
if isinstance(annot, ObjectAnnotation)
55+
][0]
56+
57+
nested_class_answers = object_annotation.classifications[0].value.answer
58+
assert len(nested_class_answers) == 2

0 commit comments

Comments
 (0)