File tree Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -295,19 +295,23 @@ def from_json(cls, payload: dict):
295
295
)
296
296
297
297
def to_payload (self ) -> dict :
298
- return {
298
+ payload = {
299
299
LABEL_KEY : self .label ,
300
300
TYPE_KEY : CUBOID_TYPE ,
301
301
GEOMETRY_KEY : {
302
302
POSITION_KEY : self .position .to_payload (),
303
303
DIMENSIONS_KEY : self .dimensions .to_payload (),
304
304
YAW_KEY : self .yaw ,
305
305
},
306
- REFERENCE_ID_KEY : self .reference_id ,
307
- ITEM_ID_KEY : self .item_id ,
308
- ANNOTATION_ID_KEY : self .annotation_id ,
309
- METADATA_KEY : self .metadata ,
310
306
}
307
+ if self .reference_id :
308
+ payload [REFERENCE_ID_KEY ] = self .reference_id
309
+ if self .annotation_id :
310
+ payload [ANNOTATION_ID_KEY ] = self .annotation_id
311
+ if self .metadata :
312
+ payload [METADATA_KEY ] = self .metadata
313
+
314
+ return payload
311
315
312
316
313
317
def is_local_path (path : str ) -> bool :
Original file line number Diff line number Diff line change @@ -87,8 +87,7 @@ def test_scene_and_cuboid_upload_sync(dataset):
87
87
lidar_item_ref = payload [SCENES_KEY ][0 ][FRAMES_KEY ][0 ]["lidar" ][
88
88
REFERENCE_ID_KEY
89
89
]
90
- lidar_item = dataset .refloc (lidar_item_ref )[ITEM_KEY ]
91
- TEST_CUBOID_ANNOTATIONS [0 ][DATASET_ITEM_ID_KEY ] = lidar_item .item_id
90
+ TEST_CUBOID_ANNOTATIONS [0 ][REFERENCE_ID_KEY ] = lidar_item_ref
92
91
93
92
annotations = [CuboidAnnotation .from_json (TEST_CUBOID_ANNOTATIONS [0 ])]
94
93
response = dataset .annotate (annotations )
@@ -97,12 +96,10 @@ def test_scene_and_cuboid_upload_sync(dataset):
97
96
assert response ["annotations_processed" ] == len (annotations )
98
97
assert response ["annotations_ignored" ] == 0
99
98
100
- response = dataset .loc (annotations [0 ].item_id )[ANNOTATIONS_KEY ]["cuboid" ]
101
- assert len (response ) == 1
102
- response_annotation = response [0 ]
99
+ response_annotations = dataset .refloc (lidar_item_ref )[ANNOTATIONS_KEY ][
100
+ "cuboid"
101
+ ]
102
+ assert len (response_annotations ) == 1
103
103
assert_cuboid_annotation_matches_dict (
104
- response_annotation , TEST_CUBOID_ANNOTATIONS [0 ]
104
+ response_annotations [ 0 ] , TEST_CUBOID_ANNOTATIONS [0 ]
105
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