Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions python/lib/sift_client/_tests/sift_types/test_ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
ChannelConfig,
FlowConfig,
IngestionConfig,
_to_rust_type,
)


Expand Down Expand Up @@ -72,6 +73,16 @@ def test_other_data_types_dont_require_special_fields(self):
)
assert channel.data_type == ChannelDataType.DOUBLE

def test_to_rust_type_covers_every_channel_data_type(self):
"""Test _to_rust_type has a branch for every ChannelDataType, including BYTES."""
# Importing here to match the lazy import convention in sift_types.ingestion
from sift_stream_bindings import ChannelDataTypePy

for data_type in ChannelDataType:
# Raises ValueError("Unknown data type: ...") if a variant is missing.
assert _to_rust_type(data_type) is not None
assert _to_rust_type(ChannelDataType.BYTES) == ChannelDataTypePy.Bytes


class TestFlowConfig:
"""Unit tests for FlowConfig model."""
Expand Down
2 changes: 2 additions & 0 deletions python/lib/sift_client/sift_types/ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,4 +529,6 @@ def _to_rust_type(data_type: ChannelDataType) -> ChannelDataTypePy:
return ChannelDataTypePy.Uint32
elif data_type == ChannelDataType.UINT_64:
return ChannelDataTypePy.Uint64
elif data_type == ChannelDataType.BYTES:
return ChannelDataTypePy.Bytes
raise ValueError(f"Unknown data type: {data_type}")
Loading