Skip to content

Commit f5ae0bb

Browse files
reformatted the file to resolve lint error.
Signed-off-by: Lokesh Rangineni <[email protected]>
1 parent 3fb590c commit f5ae0bb

File tree

1 file changed

+65
-62
lines changed

1 file changed

+65
-62
lines changed

sdk/python/tests/unit/test_sql_registry.py

Lines changed: 65 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ def mysql_registry():
8686

8787
# testing for the database to exist and ready to connect and start testing.
8888
import sqlalchemy
89-
engine = sqlalchemy.create_engine(container.get_connection_url(), pool_pre_ping=True)
89+
90+
engine = sqlalchemy.create_engine(
91+
container.get_connection_url(), pool_pre_ping=True
92+
)
9093
engine.connect()
9194

9295
registry_config = RegistryConfig(
@@ -144,19 +147,19 @@ def test_apply_entity_success(sql_registry):
144147

145148
entity = entities[0]
146149
assert (
147-
len(entities) == 1
148-
and entity.name == "driver_car_id"
149-
and entity.description == "Car driver id"
150-
and "team" in entity.tags
151-
and entity.tags["team"] == "matchmaking"
150+
len(entities) == 1
151+
and entity.name == "driver_car_id"
152+
and entity.description == "Car driver id"
153+
and "team" in entity.tags
154+
and entity.tags["team"] == "matchmaking"
152155
)
153156

154157
entity = sql_registry.get_entity("driver_car_id", project)
155158
assert (
156-
entity.name == "driver_car_id"
157-
and entity.description == "Car driver id"
158-
and "team" in entity.tags
159-
and entity.tags["team"] == "matchmaking"
159+
entity.name == "driver_car_id"
160+
and entity.description == "Car driver id"
161+
and "team" in entity.tags
162+
and entity.tags["team"] == "matchmaking"
160163
)
161164

162165
# After the first apply, the created_timestamp should be the same as the last_update_timestamp.
@@ -224,31 +227,31 @@ def test_apply_feature_view_success(sql_registry):
224227

225228
# List Feature Views
226229
assert (
227-
len(feature_views) == 1
228-
and feature_views[0].name == "my_feature_view_1"
229-
and feature_views[0].features[0].name == "fs1_my_feature_1"
230-
and feature_views[0].features[0].dtype == Int64
231-
and feature_views[0].features[1].name == "fs1_my_feature_2"
232-
and feature_views[0].features[1].dtype == String
233-
and feature_views[0].features[2].name == "fs1_my_feature_3"
234-
and feature_views[0].features[2].dtype == Array(String)
235-
and feature_views[0].features[3].name == "fs1_my_feature_4"
236-
and feature_views[0].features[3].dtype == Array(Bytes)
237-
and feature_views[0].entities[0] == "fs1_my_entity_1"
230+
len(feature_views) == 1
231+
and feature_views[0].name == "my_feature_view_1"
232+
and feature_views[0].features[0].name == "fs1_my_feature_1"
233+
and feature_views[0].features[0].dtype == Int64
234+
and feature_views[0].features[1].name == "fs1_my_feature_2"
235+
and feature_views[0].features[1].dtype == String
236+
and feature_views[0].features[2].name == "fs1_my_feature_3"
237+
and feature_views[0].features[2].dtype == Array(String)
238+
and feature_views[0].features[3].name == "fs1_my_feature_4"
239+
and feature_views[0].features[3].dtype == Array(Bytes)
240+
and feature_views[0].entities[0] == "fs1_my_entity_1"
238241
)
239242

240243
feature_view = sql_registry.get_feature_view("my_feature_view_1", project)
241244
assert (
242-
feature_view.name == "my_feature_view_1"
243-
and feature_view.features[0].name == "fs1_my_feature_1"
244-
and feature_view.features[0].dtype == Int64
245-
and feature_view.features[1].name == "fs1_my_feature_2"
246-
and feature_view.features[1].dtype == String
247-
and feature_view.features[2].name == "fs1_my_feature_3"
248-
and feature_view.features[2].dtype == Array(String)
249-
and feature_view.features[3].name == "fs1_my_feature_4"
250-
and feature_view.features[3].dtype == Array(Bytes)
251-
and feature_view.entities[0] == "fs1_my_entity_1"
245+
feature_view.name == "my_feature_view_1"
246+
and feature_view.features[0].name == "fs1_my_feature_1"
247+
and feature_view.features[0].dtype == Int64
248+
and feature_view.features[1].name == "fs1_my_feature_2"
249+
and feature_view.features[1].dtype == String
250+
and feature_view.features[2].name == "fs1_my_feature_3"
251+
and feature_view.features[2].dtype == Array(String)
252+
and feature_view.features[3].name == "fs1_my_feature_4"
253+
and feature_view.features[3].dtype == Array(Bytes)
254+
and feature_view.entities[0] == "fs1_my_entity_1"
252255
)
253256
assert feature_view.ttl == timedelta(minutes=5)
254257

@@ -338,19 +341,19 @@ def location_features_from_push(inputs: pd.DataFrame) -> pd.DataFrame:
338341

339342
# List Feature Views
340343
assert (
341-
len(feature_views) == 1
342-
and feature_views[0].name == "location_features_from_push"
343-
and feature_views[0].features[0].name == "first_char"
344-
and feature_views[0].features[0].dtype == String
344+
len(feature_views) == 1
345+
and feature_views[0].name == "location_features_from_push"
346+
and feature_views[0].features[0].name == "first_char"
347+
and feature_views[0].features[0].dtype == String
345348
)
346349

347350
feature_view = sql_registry.get_on_demand_feature_view(
348351
"location_features_from_push", project
349352
)
350353
assert (
351-
feature_view.name == "location_features_from_push"
352-
and feature_view.features[0].name == "first_char"
353-
and feature_view.features[0].dtype == String
354+
feature_view.name == "location_features_from_push"
355+
and feature_view.features[0].name == "first_char"
356+
and feature_view.features[0].dtype == String
354357
)
355358

356359
sql_registry.delete_feature_view("location_features_from_push", project)
@@ -440,51 +443,51 @@ def odfv1(feature_df: pd.DataFrame) -> pd.DataFrame:
440443
on_demand_feature_views = sql_registry.list_on_demand_feature_views(project)
441444

442445
assert (
443-
len(on_demand_feature_views) == 1
444-
and on_demand_feature_views[0].name == "odfv1"
445-
and on_demand_feature_views[0].features[0].name == "odfv1_my_feature_1"
446-
and on_demand_feature_views[0].features[0].dtype == Float32
447-
and on_demand_feature_views[0].features[1].name == "odfv1_my_feature_2"
448-
and on_demand_feature_views[0].features[1].dtype == Int32
446+
len(on_demand_feature_views) == 1
447+
and on_demand_feature_views[0].name == "odfv1"
448+
and on_demand_feature_views[0].features[0].name == "odfv1_my_feature_1"
449+
and on_demand_feature_views[0].features[0].dtype == Float32
450+
and on_demand_feature_views[0].features[1].name == "odfv1_my_feature_2"
451+
and on_demand_feature_views[0].features[1].dtype == Int32
449452
)
450453
request_schema = on_demand_feature_views[0].get_request_data_schema()
451454
assert (
452-
list(request_schema.keys())[0] == "my_input_1"
453-
and list(request_schema.values())[0] == ValueType.INT32
455+
list(request_schema.keys())[0] == "my_input_1"
456+
and list(request_schema.values())[0] == ValueType.INT32
454457
)
455458

456459
feature_view = sql_registry.get_on_demand_feature_view("odfv1", project)
457460
assert (
458-
feature_view.name == "odfv1"
459-
and feature_view.features[0].name == "odfv1_my_feature_1"
460-
and feature_view.features[0].dtype == Float32
461-
and feature_view.features[1].name == "odfv1_my_feature_2"
462-
and feature_view.features[1].dtype == Int32
461+
feature_view.name == "odfv1"
462+
and feature_view.features[0].name == "odfv1_my_feature_1"
463+
and feature_view.features[0].dtype == Float32
464+
and feature_view.features[1].name == "odfv1_my_feature_2"
465+
and feature_view.features[1].dtype == Int32
463466
)
464467
request_schema = feature_view.get_request_data_schema()
465468
assert (
466-
list(request_schema.keys())[0] == "my_input_1"
467-
and list(request_schema.values())[0] == ValueType.INT32
469+
list(request_schema.keys())[0] == "my_input_1"
470+
and list(request_schema.values())[0] == ValueType.INT32
468471
)
469472

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

473476
# List Feature Views
474477
assert (
475-
len(feature_views) == 1
476-
and feature_views[0].name == "my_feature_view_1"
477-
and feature_views[0].features[0].name == "fs1_my_feature_1"
478-
and feature_views[0].features[0].dtype == Int64
479-
and feature_views[0].entities[0] == "fs1_my_entity_1"
478+
len(feature_views) == 1
479+
and feature_views[0].name == "my_feature_view_1"
480+
and feature_views[0].features[0].name == "fs1_my_feature_1"
481+
and feature_views[0].features[0].dtype == Int64
482+
and feature_views[0].entities[0] == "fs1_my_entity_1"
480483
)
481484

482485
feature_view = sql_registry.get_feature_view("my_feature_view_1", project)
483486
assert (
484-
feature_view.name == "my_feature_view_1"
485-
and feature_view.features[0].name == "fs1_my_feature_1"
486-
and feature_view.features[0].dtype == Int64
487-
and feature_view.entities[0] == "fs1_my_entity_1"
487+
feature_view.name == "my_feature_view_1"
488+
and feature_view.features[0].name == "fs1_my_feature_1"
489+
and feature_view.features[0].dtype == Int64
490+
and feature_view.entities[0] == "fs1_my_entity_1"
488491
)
489492

490493
sql_registry.teardown()

0 commit comments

Comments
 (0)