Skip to content

Commit 647760a

Browse files
committed
AL-3578: Added nested test cases
1 parent 41c8583 commit 647760a

File tree

3 files changed

+178
-50
lines changed

3 files changed

+178
-50
lines changed

labelbox/data/serialization/ndjson/classification.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,9 @@ def lookup_classification(
262262
Radio: NDRadio
263263
}.get(type(annotation.value))
264264

265-
266-
NDSubclassificationType = Union[NDRadioSubclass, NDChecklistSubclass,
265+
# Make sure to keep NDChecklistSubclass prior to NDRadioSubclass in the list,
266+
# otherwise list of answers gets parsed by NDRadio whereas NDChecklist must be used
267+
NDSubclassificationType = Union[NDChecklistSubclass, NDRadioSubclass,
267268
NDTextSubclass]
268269

269270
# Make sure to keep NDChecklist prior to NDRadio in the list,
Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,88 @@
1-
[{"bbox": {"height": 350, "left": 2275, "top": 1352, "width": 139}, "classifications": [{"answer": {"schemaId": "ckrb1sfl8099g0y91cxbd5ftb"}, "schemaId": "ckrb1sfkn099c0y910wbo0p1a"}], "dataRow": {"id": "ckrb1sf1i1g7i0ybcdc6oc8ct"}, "schemaId": "ckrb1sfjx099a0y914hl319ie", "uuid": "f6879f59-d2b5-49c2-aceb-d9e8dc478673"}, {"bbox": {"height": 428, "left": 2089, "top": 1251, "width": 158}, "classifications": [{"answer": {"schemaId": "ckrb1sfl8099e0y919v260awv"}, "schemaId": "ckrb1sfkn099c0y910wbo0p1a"}], "dataRow": {"id": "ckrb1sf1i1g7i0ybcdc6oc8ct"}, "schemaId": "ckrb1sfjx099a0y914hl319ie", "uuid": "d009925d-91a3-4f67-abd9-753453f5a584"}, {"bbox": {"height": 428, "left": 2089, "top": 1251, "width": 158}, "classifications": [{"answer": [{"schemaId": "ckrb1sfl8099e0y919v260awv"}], "schemaId": "ckrb1sfkn099c0y910wbo0p1a"}], "dataRow": {"id": "ckrb1sf1i1g7i0ybcdc6oc8ct"}, "schemaId": "ckrb1sfjx099a0y914hl319ie", "uuid": "d009925d-91a3-4f67-abd9-753453f5a584"}, {"bbox": {"height": 428, "left": 2089, "top": 1251, "width": 158}, "classifications": [{"answer": "a string", "schemaId": "ckrb1sfkn099c0y910wbo0p1a"}], "dataRow": {"id": "ckrb1sf1i1g7i0ybcdc6oc8ct"}, "schemaId": "ckrb1sfjx099a0y914hl319ie", "uuid": "d009925d-91a3-4f67-abd9-753453f5a584"}]
1+
[
2+
{
3+
"bbox": {
4+
"height": 350,
5+
"left": 2275,
6+
"top": 1352,
7+
"width": 139
8+
},
9+
"classifications": [
10+
{
11+
"answer": {
12+
"schemaId": "ckrb1sfl8099g0y91cxbd5ftb",
13+
"confidence": 0.34
14+
},
15+
"schemaId": "ckrb1sfkn099c0y910wbo0p1a"
16+
}
17+
],
18+
"dataRow": {
19+
"id": "ckrb1sf1i1g7i0ybcdc6oc8ct"
20+
},
21+
"schemaId": "ckrb1sfjx099a0y914hl319ie",
22+
"uuid": "f6879f59-d2b5-49c2-aceb-d9e8dc478673"
23+
},
24+
{
25+
"bbox": {
26+
"height": 428,
27+
"left": 2089,
28+
"top": 1251,
29+
"width": 158
30+
},
31+
"classifications": [
32+
{
33+
"answer": {
34+
"schemaId": "ckrb1sfl8099e0y919v260awv"
35+
},
36+
"schemaId": "ckrb1sfkn099c0y910wbo0p1a"
37+
}
38+
],
39+
"dataRow": {
40+
"id": "ckrb1sf1i1g7i0ybcdc6oc8ct"
41+
},
42+
"schemaId": "ckrb1sfjx099a0y914hl319ie",
43+
"uuid": "d009925d-91a3-4f67-abd9-753453f5a584"
44+
},
45+
{
46+
"bbox": {
47+
"height": 428,
48+
"left": 2089,
49+
"top": 1251,
50+
"width": 158
51+
},
52+
"classifications": [
53+
{
54+
"answer": [
55+
{
56+
"schemaId": "ckrb1sfl8099e0y919v260awv",
57+
"confidence": 0.894
58+
}
59+
],
60+
"schemaId": "ckrb1sfkn099c0y910wbo0p1a"
61+
}
62+
],
63+
"dataRow": {
64+
"id": "ckrb1sf1i1g7i0ybcdc6oc8ct"
65+
},
66+
"schemaId": "ckrb1sfjx099a0y914hl319ie",
67+
"uuid": "d009925d-91a3-4f67-abd9-753453f5a584"
68+
},
69+
{
70+
"bbox": {
71+
"height": 428,
72+
"left": 2089,
73+
"top": 1251,
74+
"width": 158
75+
},
76+
"classifications": [
77+
{
78+
"answer": "a string",
79+
"schemaId": "ckrb1sfkn099c0y910wbo0p1a"
80+
}
81+
],
82+
"dataRow": {
83+
"id": "ckrb1sf1i1g7i0ybcdc6oc8ct"
84+
},
85+
"schemaId": "ckrb1sfjx099a0y914hl319ie",
86+
"uuid": "d009925d-91a3-4f67-abd9-753453f5a584"
87+
}
88+
]
Lines changed: 87 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,88 @@
11
[
2-
{
3-
"bbox": { "height": 350, "left": 2275, "top": 1352, "width": 139 },
4-
"classifications": [
5-
{
6-
"answer": { "name": "first answer" },
7-
"name": "classification a"
8-
}
9-
],
10-
"dataRow": { "id": "ckrb1sf1i1g7i0ybcdc6oc8ct" },
11-
"name": "box a",
12-
"uuid": "f6879f59-d2b5-49c2-aceb-d9e8dc478673"
13-
},
14-
{
15-
"bbox": { "height": 428, "left": 2089, "top": 1251, "width": 158 },
16-
"classifications": [
17-
{
18-
"answer": { "name": "second answer" },
19-
"name": "classification b"
20-
}
21-
],
22-
"dataRow": { "id": "ckrb1sf1i1g7i0ybcdc6oc8ct" },
23-
"name": "box b",
24-
"uuid": "d009925d-91a3-4f67-abd9-753453f5a584"
25-
},
26-
{
27-
"bbox": { "height": 428, "left": 2089, "top": 1251, "width": 158 },
28-
"classifications": [
29-
{
30-
"answer": [{ "name": "third answer" }],
31-
"name": "classification c"
32-
}
33-
],
34-
"dataRow": { "id": "ckrb1sf1i1g7i0ybcdc6oc8ct" },
35-
"name": "box c",
36-
"uuid": "d009925d-91a3-4f67-abd9-753453f5a584"
37-
},
38-
{
39-
"bbox": { "height": 428, "left": 2089, "top": 1251, "width": 158 },
40-
"classifications": [
41-
{ "answer": "a string", "name": "a string" }
42-
],
43-
"dataRow": { "id": "ckrb1sf1i1g7i0ybcdc6oc8ct" },
44-
"name": "box c",
45-
"uuid": "d009925d-91a3-4f67-abd9-753453f5a584"
46-
}
47-
]
48-
2+
{
3+
"bbox": {
4+
"height": 350,
5+
"left": 2275,
6+
"top": 1352,
7+
"width": 139
8+
},
9+
"classifications": [
10+
{
11+
"answer": {
12+
"name": "first answer",
13+
"confidence": 0.811
14+
},
15+
"name": "classification a"
16+
}
17+
],
18+
"dataRow": {
19+
"id": "ckrb1sf1i1g7i0ybcdc6oc8ct"
20+
},
21+
"name": "box a",
22+
"uuid": "f6879f59-d2b5-49c2-aceb-d9e8dc478673"
23+
},
24+
{
25+
"bbox": {
26+
"height": 428,
27+
"left": 2089,
28+
"top": 1251,
29+
"width": 158
30+
},
31+
"classifications": [
32+
{
33+
"answer": {
34+
"name": "second answer",
35+
"confidence": 0.815
36+
},
37+
"name": "classification b"
38+
}
39+
],
40+
"dataRow": {
41+
"id": "ckrb1sf1i1g7i0ybcdc6oc8ct"
42+
},
43+
"name": "box b",
44+
"uuid": "d009925d-91a3-4f67-abd9-753453f5a584"
45+
},
46+
{
47+
"bbox": {
48+
"height": 428,
49+
"left": 2089,
50+
"top": 1251,
51+
"width": 158
52+
},
53+
"classifications": [
54+
{
55+
"answer": [
56+
{
57+
"name": "third answer"
58+
}
59+
],
60+
"name": "classification c"
61+
}
62+
],
63+
"dataRow": {
64+
"id": "ckrb1sf1i1g7i0ybcdc6oc8ct"
65+
},
66+
"name": "box c",
67+
"uuid": "d009925d-91a3-4f67-abd9-753453f5a584"
68+
},
69+
{
70+
"bbox": {
71+
"height": 428,
72+
"left": 2089,
73+
"top": 1251,
74+
"width": 158
75+
},
76+
"classifications": [
77+
{
78+
"answer": "a string",
79+
"name": "a string"
80+
}
81+
],
82+
"dataRow": {
83+
"id": "ckrb1sf1i1g7i0ybcdc6oc8ct"
84+
},
85+
"name": "box c",
86+
"uuid": "d009925d-91a3-4f67-abd9-753453f5a584"
87+
}
88+
]

0 commit comments

Comments
 (0)