Skip to content

Commit

Permalink
test: Fix test_validate_rail_side scene creation
Browse files Browse the repository at this point in the history
  • Loading branch information
nalquas committed Nov 7, 2024
1 parent a1c61e1 commit 6d2a5e4
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@

def test_validate_rail_side__no_errors(empty_scene, empty_frame):
scene = empty_scene
scene.objects["a1082ef9-555b-4b69-a888-7da531d8a2eb"] = raillabel.format.Object(
uid="a1082ef9-555b-4b69-a888-7da531d8a2eb", name="track0001", type="track"
)
object = raillabel.format.Object(
uid="a1082ef9-555b-4b69-a888-7da531d8a2eb", name="track0001", type="track"
)
scene.objects[object.uid] = object
sensor = raillabel.format.Sensor(
uid="rgb_center",
type=raillabel.format.SensorType.CAMERA,
)
scene.sensors[sensor.uid] = sensor
frame = empty_frame
frame.annotations["325b1f55-a2ef-475f-a780-13e1a9e823c3"] = raillabel.format.Poly2d(
uid="325b1f55-a2ef-475f-a780-13e1a9e823c3",
Expand All @@ -44,23 +43,23 @@ def test_validate_rail_side__no_errors(empty_scene, empty_frame):
closed=False,
attributes={"railSide": "rightRail"},
)
scene.frames[frame.uid] = frame

actual = validate_rail_side(scene)
assert len(actual) == 0


def test_validate_rail_side__rail_sides_switched(empty_scene, empty_frame):
scene = empty_scene
scene.objects["a1082ef9-555b-4b69-a888-7da531d8a2eb"] = raillabel.format.Object(
uid="a1082ef9-555b-4b69-a888-7da531d8a2eb", name="track0001", type="track"
)
object = raillabel.format.Object(
uid="a1082ef9-555b-4b69-a888-7da531d8a2eb", name="track0001", type="track"
)
scene.objects[object.uid] = object
sensor = raillabel.format.Sensor(
uid="rgb_center",
type=raillabel.format.SensorType.CAMERA,
)
scene.sensors[sensor.uid] = sensor
frame = empty_frame
frame.annotations["325b1f55-a2ef-475f-a780-13e1a9e823c3"] = raillabel.format.Poly2d(
uid="325b1f55-a2ef-475f-a780-13e1a9e823c3",
Expand All @@ -84,23 +83,23 @@ def test_validate_rail_side__rail_sides_switched(empty_scene, empty_frame):
closed=False,
attributes={"railSide": "leftRail"},
)
scene.frames[frame.uid] = frame

actual = validate_rail_side(scene)
assert len(actual) == 1


def test_validate_rail_side__two_left_rails(empty_scene, empty_frame):
scene = empty_scene
scene.objects["a1082ef9-555b-4b69-a888-7da531d8a2eb"] = raillabel.format.Object(
uid="a1082ef9-555b-4b69-a888-7da531d8a2eb", name="track0001", type="track"
)
object = raillabel.format.Object(
uid="a1082ef9-555b-4b69-a888-7da531d8a2eb", name="track0001", type="track"
)
scene.objects[object.uid] = object
sensor = raillabel.format.Sensor(
uid="rgb_center",
type=raillabel.format.SensorType.CAMERA,
)
scene.sensors[sensor.uid] = sensor
frame = empty_frame
frame.annotations["325b1f55-a2ef-475f-a780-13e1a9e823c3"] = raillabel.format.Poly2d(
uid="325b1f55-a2ef-475f-a780-13e1a9e823c3",
Expand All @@ -124,23 +123,23 @@ def test_validate_rail_side__two_left_rails(empty_scene, empty_frame):
closed=False,
attributes={"railSide": "leftRail"},
)
scene.frames[frame.uid] = frame

actual = validate_rail_side(scene)
assert len(actual) == 1


def test_validate_rail_side__two_right_rails(empty_scene, empty_frame):
scene = empty_scene
scene.objects["a1082ef9-555b-4b69-a888-7da531d8a2eb"] = raillabel.format.Object(
uid="a1082ef9-555b-4b69-a888-7da531d8a2eb", name="track0001", type="track"
)
object = raillabel.format.Object(
uid="a1082ef9-555b-4b69-a888-7da531d8a2eb", name="track0001", type="track"
)
scene.objects[object.uid] = object
sensor = raillabel.format.Sensor(
uid="rgb_center",
type=raillabel.format.SensorType.CAMERA,
)
scene.sensors[sensor.uid] = sensor
frame = empty_frame
frame.annotations["325b1f55-a2ef-475f-a780-13e1a9e823c3"] = raillabel.format.Poly2d(
uid="325b1f55-a2ef-475f-a780-13e1a9e823c3",
Expand All @@ -164,6 +163,7 @@ def test_validate_rail_side__two_right_rails(empty_scene, empty_frame):
closed=False,
attributes={"railSide": "rightRail"},
)
scene.frames[frame.uid] = frame

actual = validate_rail_side(scene)
assert len(actual) == 1
Expand Down

0 comments on commit 6d2a5e4

Please sign in to comment.