Skip to content

Commit

Permalink
Cleanup tests (#1901)
Browse files Browse the repository at this point in the history
* Remove infer_event_timestamp_col

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

* Remove unnecessary historical retrieval test

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

* Remove more unnecessary tests

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

* Move test from integration to unit

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

* Rename test file to avoid pytest conflicts

Signed-off-by: Felix Wang <wangfelix98@gmail.com>
  • Loading branch information
felixwang9817 committed Sep 23, 2021
1 parent 3078bfb commit dcae160
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 602 deletions.
54 changes: 17 additions & 37 deletions sdk/python/feast/driver_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ def _convert_event_timestamp(event_timestamp: pd.Timestamp, t: EventTimestampTyp


def create_orders_df(
customers,
drivers,
start_date,
end_date,
order_count,
infer_event_timestamp_col=False,
customers, drivers, start_date, end_date, order_count,
) -> pd.DataFrame:
"""
Example df generated by this function:
Expand All @@ -51,39 +46,24 @@ def create_orders_df(
df["driver_id"] = np.random.choice(drivers, order_count)
df["customer_id"] = np.random.choice(customers, order_count)
df["order_is_success"] = np.random.randint(0, 2, size=order_count).astype(np.int32)

if infer_event_timestamp_col:
df["e_ts"] = [
_convert_event_timestamp(
pd.Timestamp(dt, unit="ms", tz="UTC").round("ms"),
EventTimestampType(3),
)
for idx, dt in enumerate(
pd.date_range(start=start_date, end=end_date, periods=order_count)
)
]
df.sort_values(
by=["e_ts", "order_id", "driver_id", "customer_id"], inplace=True,
df[DEFAULT_ENTITY_DF_EVENT_TIMESTAMP_COL] = [
_convert_event_timestamp(
pd.Timestamp(dt, unit="ms", tz="UTC").round("ms"),
EventTimestampType(idx % 4),
)
else:
df[DEFAULT_ENTITY_DF_EVENT_TIMESTAMP_COL] = [
_convert_event_timestamp(
pd.Timestamp(dt, unit="ms", tz="UTC").round("ms"),
EventTimestampType(idx % 4),
)
for idx, dt in enumerate(
pd.date_range(start=start_date, end=end_date, periods=order_count)
)
]
df.sort_values(
by=[
DEFAULT_ENTITY_DF_EVENT_TIMESTAMP_COL,
"order_id",
"driver_id",
"customer_id",
],
inplace=True,
for idx, dt in enumerate(
pd.date_range(start=start_date, end=end_date, periods=order_count)
)
]
df.sort_values(
by=[
DEFAULT_ENTITY_DF_EVENT_TIMESTAMP_COL,
"order_id",
"driver_id",
"customer_id",
],
inplace=True,
)
return df


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class IntegrationTestRepoConfig:
offline_store_creator: Type[DataSourceCreator] = FileDataSourceCreator

full_feature_names: bool = True
infer_event_timestamp_col: bool = True
infer_features: bool = False

def __repr__(self) -> str:
Expand Down
Loading

0 comments on commit dcae160

Please sign in to comment.