Skip to content

Commit 2f7c80c

Browse files
authored
test: update unit testrings for dataclass module (#238)
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
1 parent 42b9825 commit 2f7c80c

3 files changed

Lines changed: 27 additions & 3 deletions

File tree

t4_devkit/dataclass/pointcloud.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
from __future__ import annotations
22

3-
from t4_devkit.common.io import load_json
43
import struct
54
from abc import abstractmethod
65
from typing import TYPE_CHECKING, ClassVar, TypeVar
76

87
import numpy as np
98
from attrs import define, field
109

10+
from t4_devkit.common.io import load_json
11+
1112
if TYPE_CHECKING:
1213
from typing_extensions import Self
1314

@@ -252,7 +253,7 @@ class RadarPointCloud(PointCloud):
252253

253254
# class variables
254255
invalid_states: ClassVar[list[int]] = [0]
255-
dynprop_states: ClassVar[list[int]] = range(7)
256+
dynprop_states: ClassVar[list[int]] = list(range(7))
256257
ambig_states: ClassVar[list[int]] = [3]
257258

258259
@staticmethod

tests/dataclass/test_label.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from __future__ import annotations
2+
3+
from t4_devkit.dataclass.label import SemanticLabel
4+
5+
6+
def test_semantic_label() -> None:
7+
label = SemanticLabel("car", ["vehicle.car"])
8+
9+
# check properties
10+
assert label.name == "car"
11+
assert label.attributes == ["vehicle.car"]
12+
13+
# same instance
14+
assert label == label
15+
# same label name
16+
assert label == SemanticLabel("car")
17+
assert label == "car"
18+
# same label name, but different case
19+
assert label != SemanticLabel("Car")
20+
assert label != "Car"
21+
# different label name
22+
assert label != SemanticLabel("bike")
23+
assert label != "bike"

tests/dataclass/test_trajectory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import numpy as np
44
import pytest
5-
from pyquaternion import Quaternion
65

76
from t4_devkit.dataclass.trajectory import Future
7+
from t4_devkit.typing import Quaternion
88

99

1010
def test_future_trajectory(dummy_future: Future) -> None:

0 commit comments

Comments
 (0)