Skip to content

Commit 362dfc4

Browse files
author
Tsotne Tabidze
committed
Fix unit tests that got broken by Pandas 1.3.0 release
Signed-off-by: Tsotne Tabidze <tsotne@tecton.ai>
1 parent 1f64c4d commit 362dfc4

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

sdk/python/feast/driver_test_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ def create_driver_hourly_stats_df(drivers, start_date, end_date) -> pd.DataFrame
140140
# TODO: These duplicate rows area indirectly being filtered out by the point in time join already. We need to
141141
# inject a bad row at a timestamp where we know it will get joined to the entity dataframe, and then test that
142142
# we are actually filtering it with the created timestamp
143-
late_row = df_all_drivers.iloc[int(rows / 2)]
144-
df_all_drivers = df_all_drivers.append(late_row).append(late_row)
143+
late_row = df_all_drivers[rows // 2 : rows // 2 + 1]
144+
df_all_drivers = pd.concat([df_all_drivers, late_row, late_row], ignore_index=True)
145145

146146
return df_all_drivers
147147

sdk/python/tests/test_historical_retrieval.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,14 @@ def get_expected_training_df(
195195
expected_df = expected_df[[event_timestamp] + current_cols]
196196

197197
# Cast some columns to expected types, since we lose information when converting pandas DFs into Python objects.
198-
expected_df["order_is_success"] = expected_df["order_is_success"].astype("int32")
199-
expected_df["customer_profile__current_balance"] = expected_df[
200-
"customer_profile__current_balance"
201-
].astype("float32")
202-
expected_df["customer_profile__avg_passenger_count"] = expected_df[
203-
"customer_profile__avg_passenger_count"
204-
].astype("float32")
198+
expected_column_types = {
199+
"order_is_success": "int32",
200+
"driver_stats__conv_rate": "float32",
201+
"customer_profile__current_balance": "float32",
202+
"customer_profile__avg_passenger_count": "float32",
203+
}
204+
for col, typ in expected_column_types.items():
205+
expected_df[col] = expected_df[col].astype(typ)
205206

206207
return expected_df
207208

sdk/python/tests/test_offline_online_store_consistency.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import contextlib
2+
import math
23
import tempfile
34
import time
45
import uuid
@@ -212,8 +213,7 @@ def check_offline_and_online_features(
212213
if expected_value:
213214
assert abs(df.to_dict()[f"{fv.name}__value"][0] - expected_value) < 1e-6
214215
else:
215-
df = df.where(pd.notnull(df), None)
216-
assert df.to_dict()[f"{fv.name}__value"][0] is None
216+
assert math.isnan(df.to_dict()[f"{fv.name}__value"][0])
217217

218218

219219
def run_offline_online_store_consistency_test(

0 commit comments

Comments
 (0)