Skip to content

Commit

Permalink
reformatted the file to resolve lint error.
Browse files Browse the repository at this point in the history
Signed-off-by: Lokesh Rangineni <[email protected]>
  • Loading branch information
lokeshrangineni committed Apr 25, 2024
1 parent d30914b commit 3fb590c
Showing 1 changed file with 61 additions and 62 deletions.
123 changes: 61 additions & 62 deletions sdk/python/tests/unit/test_sql_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
POSTGRES_PASSWORD = "test"
POSTGRES_DB = "test"


logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -145,19 +144,19 @@ def test_apply_entity_success(sql_registry):

entity = entities[0]
assert (
len(entities) == 1
and entity.name == "driver_car_id"
and entity.description == "Car driver id"
and "team" in entity.tags
and entity.tags["team"] == "matchmaking"
len(entities) == 1
and entity.name == "driver_car_id"
and entity.description == "Car driver id"
and "team" in entity.tags
and entity.tags["team"] == "matchmaking"
)

entity = sql_registry.get_entity("driver_car_id", project)
assert (
entity.name == "driver_car_id"
and entity.description == "Car driver id"
and "team" in entity.tags
and entity.tags["team"] == "matchmaking"
entity.name == "driver_car_id"
and entity.description == "Car driver id"
and "team" in entity.tags
and entity.tags["team"] == "matchmaking"
)

# After the first apply, the created_timestamp should be the same as the last_update_timestamp.
Expand Down Expand Up @@ -225,31 +224,31 @@ def test_apply_feature_view_success(sql_registry):

# List Feature Views
assert (
len(feature_views) == 1
and feature_views[0].name == "my_feature_view_1"
and feature_views[0].features[0].name == "fs1_my_feature_1"
and feature_views[0].features[0].dtype == Int64
and feature_views[0].features[1].name == "fs1_my_feature_2"
and feature_views[0].features[1].dtype == String
and feature_views[0].features[2].name == "fs1_my_feature_3"
and feature_views[0].features[2].dtype == Array(String)
and feature_views[0].features[3].name == "fs1_my_feature_4"
and feature_views[0].features[3].dtype == Array(Bytes)
and feature_views[0].entities[0] == "fs1_my_entity_1"
len(feature_views) == 1
and feature_views[0].name == "my_feature_view_1"
and feature_views[0].features[0].name == "fs1_my_feature_1"
and feature_views[0].features[0].dtype == Int64
and feature_views[0].features[1].name == "fs1_my_feature_2"
and feature_views[0].features[1].dtype == String
and feature_views[0].features[2].name == "fs1_my_feature_3"
and feature_views[0].features[2].dtype == Array(String)
and feature_views[0].features[3].name == "fs1_my_feature_4"
and feature_views[0].features[3].dtype == Array(Bytes)
and feature_views[0].entities[0] == "fs1_my_entity_1"
)

feature_view = sql_registry.get_feature_view("my_feature_view_1", project)
assert (
feature_view.name == "my_feature_view_1"
and feature_view.features[0].name == "fs1_my_feature_1"
and feature_view.features[0].dtype == Int64
and feature_view.features[1].name == "fs1_my_feature_2"
and feature_view.features[1].dtype == String
and feature_view.features[2].name == "fs1_my_feature_3"
and feature_view.features[2].dtype == Array(String)
and feature_view.features[3].name == "fs1_my_feature_4"
and feature_view.features[3].dtype == Array(Bytes)
and feature_view.entities[0] == "fs1_my_entity_1"
feature_view.name == "my_feature_view_1"
and feature_view.features[0].name == "fs1_my_feature_1"
and feature_view.features[0].dtype == Int64
and feature_view.features[1].name == "fs1_my_feature_2"
and feature_view.features[1].dtype == String
and feature_view.features[2].name == "fs1_my_feature_3"
and feature_view.features[2].dtype == Array(String)
and feature_view.features[3].name == "fs1_my_feature_4"
and feature_view.features[3].dtype == Array(Bytes)
and feature_view.entities[0] == "fs1_my_entity_1"
)
assert feature_view.ttl == timedelta(minutes=5)

Expand Down Expand Up @@ -339,19 +338,19 @@ def location_features_from_push(inputs: pd.DataFrame) -> pd.DataFrame:

# List Feature Views
assert (
len(feature_views) == 1
and feature_views[0].name == "location_features_from_push"
and feature_views[0].features[0].name == "first_char"
and feature_views[0].features[0].dtype == String
len(feature_views) == 1
and feature_views[0].name == "location_features_from_push"
and feature_views[0].features[0].name == "first_char"
and feature_views[0].features[0].dtype == String
)

feature_view = sql_registry.get_on_demand_feature_view(
"location_features_from_push", project
)
assert (
feature_view.name == "location_features_from_push"
and feature_view.features[0].name == "first_char"
and feature_view.features[0].dtype == String
feature_view.name == "location_features_from_push"
and feature_view.features[0].name == "first_char"
and feature_view.features[0].dtype == String
)

sql_registry.delete_feature_view("location_features_from_push", project)
Expand Down Expand Up @@ -441,51 +440,51 @@ def odfv1(feature_df: pd.DataFrame) -> pd.DataFrame:
on_demand_feature_views = sql_registry.list_on_demand_feature_views(project)

assert (
len(on_demand_feature_views) == 1
and on_demand_feature_views[0].name == "odfv1"
and on_demand_feature_views[0].features[0].name == "odfv1_my_feature_1"
and on_demand_feature_views[0].features[0].dtype == Float32
and on_demand_feature_views[0].features[1].name == "odfv1_my_feature_2"
and on_demand_feature_views[0].features[1].dtype == Int32
len(on_demand_feature_views) == 1
and on_demand_feature_views[0].name == "odfv1"
and on_demand_feature_views[0].features[0].name == "odfv1_my_feature_1"
and on_demand_feature_views[0].features[0].dtype == Float32
and on_demand_feature_views[0].features[1].name == "odfv1_my_feature_2"
and on_demand_feature_views[0].features[1].dtype == Int32
)
request_schema = on_demand_feature_views[0].get_request_data_schema()
assert (
list(request_schema.keys())[0] == "my_input_1"
and list(request_schema.values())[0] == ValueType.INT32
list(request_schema.keys())[0] == "my_input_1"
and list(request_schema.values())[0] == ValueType.INT32
)

feature_view = sql_registry.get_on_demand_feature_view("odfv1", project)
assert (
feature_view.name == "odfv1"
and feature_view.features[0].name == "odfv1_my_feature_1"
and feature_view.features[0].dtype == Float32
and feature_view.features[1].name == "odfv1_my_feature_2"
and feature_view.features[1].dtype == Int32
feature_view.name == "odfv1"
and feature_view.features[0].name == "odfv1_my_feature_1"
and feature_view.features[0].dtype == Float32
and feature_view.features[1].name == "odfv1_my_feature_2"
and feature_view.features[1].dtype == Int32
)
request_schema = feature_view.get_request_data_schema()
assert (
list(request_schema.keys())[0] == "my_input_1"
and list(request_schema.values())[0] == ValueType.INT32
list(request_schema.keys())[0] == "my_input_1"
and list(request_schema.values())[0] == ValueType.INT32
)

# Make sure fv1 is untouched
feature_views = sql_registry.list_feature_views(project)

# List Feature Views
assert (
len(feature_views) == 1
and feature_views[0].name == "my_feature_view_1"
and feature_views[0].features[0].name == "fs1_my_feature_1"
and feature_views[0].features[0].dtype == Int64
and feature_views[0].entities[0] == "fs1_my_entity_1"
len(feature_views) == 1
and feature_views[0].name == "my_feature_view_1"
and feature_views[0].features[0].name == "fs1_my_feature_1"
and feature_views[0].features[0].dtype == Int64
and feature_views[0].entities[0] == "fs1_my_entity_1"
)

feature_view = sql_registry.get_feature_view("my_feature_view_1", project)
assert (
feature_view.name == "my_feature_view_1"
and feature_view.features[0].name == "fs1_my_feature_1"
and feature_view.features[0].dtype == Int64
and feature_view.entities[0] == "fs1_my_entity_1"
feature_view.name == "my_feature_view_1"
and feature_view.features[0].name == "fs1_my_feature_1"
and feature_view.features[0].dtype == Int64
and feature_view.entities[0] == "fs1_my_entity_1"
)

sql_registry.teardown()
Expand Down

0 comments on commit 3fb590c

Please sign in to comment.