Skip to content
Prev Previous commit
Next Next commit
Add a test
Signed-off-by: Achal Shah <achals@gmail.com>
  • Loading branch information
achals committed Jul 19, 2022
commit b70951157775c4c9e68f302b1ca66ee756f81553
28 changes: 28 additions & 0 deletions sdk/python/tests/unit/infra/test_key_encoding_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pytest

from feast.infra.key_encoding_utils import serialize_entity_key
from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
from feast.protos.feast.types.Value_pb2 import Value as ValueProto


@pytest.mark.parametrize(
"entity_key,expected_contains",
[
(
EntityKeyProto(
join_keys=["customer"],
entity_values=[ValueProto(int64_val=int(2 ** 31))],
),
b"customer",
),
(
EntityKeyProto(
join_keys=["user"], entity_values=[ValueProto(int32_val=int(2 ** 15))]
),
b"user",
),
],
)
def test_serialize_entity_key(entity_key, expected_contains):
output = serialize_entity_key(entity_key)
assert output.find(expected_contains) >= 0