Skip to content

Commit

Permalink
Test semantically empty columns
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs committed Oct 15, 2024
1 parent a7f01bd commit 35e379e
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions rerun_py/tests/unit/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def setup_method(self) -> None:
rr.init(APP_ID, recording_id=RECORDING_ID)

rr.set_time_sequence("my_index", 1)
rr.log("points", rr.Points3D([[1, 2, 3], [4, 5, 6], [7, 8, 9]]))
rr.log("points", rr.Points3D([[1, 2, 3], [4, 5, 6], [7, 8, 9]], radii=[]))
rr.set_time_sequence("my_index", 7)
rr.log("points", rr.Points3D([[10, 11, 12]], colors=[[255, 0, 0]]))

Expand Down Expand Up @@ -98,9 +98,10 @@ def test_recording_info(self) -> None:
def test_schema_recording(self) -> None:
schema = self.recording.schema()

# log_tick, log_time, my_index
assert len(schema.index_columns()) == 3
# Points3DIndicator, Position3D, Color
assert len(schema.component_columns()) == 3
# Color, Points3DIndicator, Position3D, Radius
assert len(schema.component_columns()) == 4

assert schema.index_columns()[0].name == "log_tick"
assert schema.index_columns()[1].name == "log_time"
Expand All @@ -111,6 +112,8 @@ def test_schema_recording(self) -> None:
assert schema.component_columns()[1].component_name == "rerun.components.Points3DIndicator"
assert schema.component_columns()[2].entity_path == "/points"
assert schema.component_columns()[2].component_name == "rerun.components.Position3D"
assert schema.component_columns()[3].entity_path == "/points"
assert schema.component_columns()[3].component_name == "rerun.components.Radius"

def test_schema_view(self) -> None:
schema = self.recording.view(index="my_index", contents="/**").schema()
Expand All @@ -127,6 +130,18 @@ def test_schema_view(self) -> None:
assert schema.component_columns()[1].entity_path == "/points"
assert schema.component_columns()[1].component_name == "rerun.components.Position3D"

# Force radius to be included
schema = self.recording.view(
index="my_index",
contents="/**",
include_semantically_empty_columns=True,
).schema()

assert len(schema.index_columns()) == 3
# Color, Position3D, Radius
assert len(schema.component_columns()) == 3
assert schema.component_columns()[2].component_name == "rerun.components.Radius"

def test_full_view(self) -> None:
view = self.recording.view(index="my_index", contents="points")

Expand Down

0 comments on commit 35e379e

Please sign in to comment.