diff --git a/python/lib/sift_client/_tests/sift_types/test_ingestion.py b/python/lib/sift_client/_tests/sift_types/test_ingestion.py index cd31221d61..9451b78da3 100644 --- a/python/lib/sift_client/_tests/sift_types/test_ingestion.py +++ b/python/lib/sift_client/_tests/sift_types/test_ingestion.py @@ -10,6 +10,7 @@ ChannelConfig, FlowConfig, IngestionConfig, + _to_rust_type, ) @@ -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.""" diff --git a/python/lib/sift_client/sift_types/ingestion.py b/python/lib/sift_client/sift_types/ingestion.py index d8db6d2070..97e905bd00 100644 --- a/python/lib/sift_client/sift_types/ingestion.py +++ b/python/lib/sift_client/sift_types/ingestion.py @@ -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}")