Visitar URL original
test: Cover the async path for empty entity rows · feast-dev/feast@f96b47b · GitHub
Skip to content

Commit f96b47b

Browse files
Daksha1611ntkathole
authored andcommitted
test: Cover the async path for empty entity rows
The guard was added to both get_online_features and its async twin, but only the sync one had a test. Without the fix the async case raises IndexError: list index out of range. Signed-off-by: Daksha1611 <mehtadaksha1611@gmail.com>
1 parent 49d6c55 commit f96b47b

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎sdk/python/tests/unit/online_store/test_empty_entity_rows.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
which the feature server turned into a 500.
66
"""
77

8+
import asyncio
9+
810
import pytest
911
from fastapi import status as HttpStatusCode
1012

@@ -52,3 +54,20 @@ def test_request_without_join_keys_raises_a_client_error(entity_rows):
5254
store.get_online_features(features=FEATURES, entity_rows=entity_rows)
5355

5456
assert "driver_id" in str(excinfo.value)
57+
58+
59+
@pytest.mark.parametrize("entity_rows", [[], {}], ids=["empty_list", "no_columns"])
60+
def test_request_without_join_keys_raises_a_client_error_async(entity_rows):
61+
"""``entity_rows=[]`` indexed ``[0]`` on the async path too."""
62+
runner = CliRunner()
63+
with runner.local_repo(
64+
get_example_repo("example_feature_repo_1.py"), "file"
65+
) as store:
66+
with pytest.raises(MissingJoinKeyValuesException) as excinfo:
67+
asyncio.run(
68+
store.get_online_features_async(
69+
features=FEATURES, entity_rows=entity_rows
70+
)
71+
)
72+
73+
assert "driver_id" in str(excinfo.value)

0 commit comments

Comments
 (0)