File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change 1
1
import pytest
2
- from nucleus .constants import SCENES_KEY , UPDATE_KEY
2
+ from nucleus .constants import (
3
+ ANNOTATIONS_KEY ,
4
+ DATASET_ITEM_ID_KEY ,
5
+ FRAMES_KEY ,
6
+ ITEM_KEY ,
7
+ REFERENCE_ID_KEY ,
8
+ SCENES_KEY ,
9
+ UPDATE_KEY ,
10
+ )
3
11
4
12
from nucleus import (
5
13
CuboidAnnotation ,
@@ -76,17 +84,25 @@ def test_scene_and_cuboid_upload_sync(dataset):
76
84
assert response ["dataset_id" ] == dataset .id
77
85
assert response ["new_scenes" ] == len (scenes )
78
86
79
- TEST_CUBOID_ANNOTATIONS [0 ]["dataset_item_id" ] = dataset .items [0 ].item_id
87
+ lidar_item_ref = payload [SCENES_KEY ][0 ][FRAMES_KEY ][0 ]["lidar" ][
88
+ REFERENCE_ID_KEY
89
+ ]
90
+ lidar_item = dataset .refloc (lidar_item_ref )[ITEM_KEY ]
91
+ TEST_CUBOID_ANNOTATIONS [0 ][DATASET_ITEM_ID_KEY ] = lidar_item .item_id
92
+
80
93
annotations = [CuboidAnnotation .from_json (TEST_CUBOID_ANNOTATIONS [0 ])]
81
94
response = dataset .annotate (annotations )
82
95
83
96
assert response ["dataset_id" ] == dataset .id
84
97
assert response ["annotations_processed" ] == len (annotations )
85
98
assert response ["annotations_ignored" ] == 0
86
99
87
- response = dataset .loc (annotations [0 ].item_id )["annotations" ]["cuboid" ]
100
+ response = dataset .loc (annotations [0 ].item_id )[ANNOTATIONS_KEY ]["cuboid" ]
88
101
assert len (response ) == 1
89
102
response_annotation = response [0 ]
90
103
assert_cuboid_annotation_matches_dict (
91
104
response_annotation , TEST_CUBOID_ANNOTATIONS [0 ]
92
105
)
106
+
107
+ lidar_item_ann = dataset .refloc (lidar_item_ref )[ANNOTATIONS_KEY ]["cuboid" ]
108
+ assert annotations == lidar_item_ann
You can’t perform that action at this time.
0 commit comments