Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Fix ODFV decorator in integration tests
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
  • Loading branch information
felixwang9817 committed Apr 12, 2022
commit a63590c4f6f878073214a144d93451766da2c795
27 changes: 19 additions & 8 deletions sdk/python/tests/integration/registration/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
SpecifiedFeaturesNotPresentError,
)
from feast.feature_view import FeatureView
from feast.field import Field
from feast.inference import (
update_data_sources_with_inferred_event_timestamp_col,
update_entities_with_inferred_types_from_feature_views,
Expand All @@ -28,6 +29,7 @@
SparkSource,
)
from feast.on_demand_feature_view import on_demand_feature_view
from feast.types import String, UnixTimestamp
from tests.utils.data_source_utils import (
prep_file_source,
simple_bq_source_using_query_arg,
Expand Down Expand Up @@ -185,7 +187,10 @@ def test_view(features_df: pd.DataFrame) -> pd.DataFrame:
test_view.infer_features()

@on_demand_feature_view(
sources={"date_request": date_request},
# Note: we deliberately use `inputs` instead of `sources` to test that `inputs`
# still works correctly, even though it is deprecated.
# TODO(felixwang9817): Remove references to `inputs` once it is fully deprecated.
inputs={"date_request": date_request},
features=[
Feature(name="output", dtype=ValueType.UNIX_TIMESTAMP),
Feature(name="object_output", dtype=ValueType.STRING),
Expand All @@ -201,11 +206,14 @@ def invalid_test_view(features_df: pd.DataFrame) -> pd.DataFrame:
invalid_test_view.infer_features()

@on_demand_feature_view(
sources={"date_request": date_request},
features=[
# Note: we deliberately use positional arguments here to test that they work correctly,
# even though positional arguments are deprecated in favor of keyword arguments.
# TODO(felixwang9817): Remove positional arguments once they are fully deprecated.
[
Feature(name="output", dtype=ValueType.UNIX_TIMESTAMP),
Feature(name="missing", dtype=ValueType.STRING),
],
{"date_request": date_request},
)
def test_view_with_missing_feature(features_df: pd.DataFrame) -> pd.DataFrame:
data = pd.DataFrame()
Expand All @@ -223,11 +231,14 @@ def test_datasource_inference():
)

@on_demand_feature_view(
sources={"date_request": date_request},
features=[
# Note: we deliberately use positional arguments here to test that they work correctly,
# even though positional arguments are deprecated in favor of keyword arguments.
# TODO(felixwang9817): Remove positional arguments once they are fully deprecated.
[
Feature(name="output", dtype=ValueType.UNIX_TIMESTAMP),
Feature(name="string_output", dtype=ValueType.STRING),
],
sources={"date_request": date_request},
)
def test_view(features_df: pd.DataFrame) -> pd.DataFrame:
data = pd.DataFrame()
Expand All @@ -239,9 +250,9 @@ def test_view(features_df: pd.DataFrame) -> pd.DataFrame:

@on_demand_feature_view(
sources={"date_request": date_request},
features=[
Feature(name="output", dtype=ValueType.UNIX_TIMESTAMP),
Feature(name="object_output", dtype=ValueType.STRING),
schema=[
Field(name="output", dtype=UnixTimestamp),
Field(name="object_output", dtype=String),
],
)
def invalid_test_view(features_df: pd.DataFrame) -> pd.DataFrame:
Expand Down