Skip to content

Commit 85f69fe

Browse files
Drew KaulDrew Kaul
authored andcommitted
fix cuboid upload integration test
1 parent 9fe03c5 commit 85f69fe

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

tests/test_scene.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
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+
)
311

412
from nucleus import (
513
CuboidAnnotation,
@@ -76,17 +84,25 @@ def test_scene_and_cuboid_upload_sync(dataset):
7684
assert response["dataset_id"] == dataset.id
7785
assert response["new_scenes"] == len(scenes)
7886

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+
8093
annotations = [CuboidAnnotation.from_json(TEST_CUBOID_ANNOTATIONS[0])]
8194
response = dataset.annotate(annotations)
8295

8396
assert response["dataset_id"] == dataset.id
8497
assert response["annotations_processed"] == len(annotations)
8598
assert response["annotations_ignored"] == 0
8699

87-
response = dataset.loc(annotations[0].item_id)["annotations"]["cuboid"]
100+
response = dataset.loc(annotations[0].item_id)[ANNOTATIONS_KEY]["cuboid"]
88101
assert len(response) == 1
89102
response_annotation = response[0]
90103
assert_cuboid_annotation_matches_dict(
91104
response_annotation, TEST_CUBOID_ANNOTATIONS[0]
92105
)
106+
107+
lidar_item_ann = dataset.refloc(lidar_item_ref)[ANNOTATIONS_KEY]["cuboid"]
108+
assert annotations == lidar_item_ann

0 commit comments

Comments
 (0)