|
42 | 42 | POSTGRES_PASSWORD = "test" |
43 | 43 | POSTGRES_DB = "test" |
44 | 44 |
|
45 | | - |
46 | 45 | logger = logging.getLogger(__name__) |
47 | 46 |
|
48 | 47 |
|
@@ -145,19 +144,19 @@ def test_apply_entity_success(sql_registry): |
145 | 144 |
|
146 | 145 | entity = entities[0] |
147 | 146 | assert ( |
148 | | - len(entities) == 1 |
149 | | - and entity.name == "driver_car_id" |
150 | | - and entity.description == "Car driver id" |
151 | | - and "team" in entity.tags |
152 | | - and entity.tags["team"] == "matchmaking" |
| 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" |
153 | 152 | ) |
154 | 153 |
|
155 | 154 | entity = sql_registry.get_entity("driver_car_id", project) |
156 | 155 | assert ( |
157 | | - entity.name == "driver_car_id" |
158 | | - and entity.description == "Car driver id" |
159 | | - and "team" in entity.tags |
160 | | - and entity.tags["team"] == "matchmaking" |
| 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" |
161 | 160 | ) |
162 | 161 |
|
163 | 162 | # After the first apply, the created_timestamp should be the same as the last_update_timestamp. |
@@ -225,31 +224,31 @@ def test_apply_feature_view_success(sql_registry): |
225 | 224 |
|
226 | 225 | # List Feature Views |
227 | 226 | assert ( |
228 | | - len(feature_views) == 1 |
229 | | - and feature_views[0].name == "my_feature_view_1" |
230 | | - and feature_views[0].features[0].name == "fs1_my_feature_1" |
231 | | - and feature_views[0].features[0].dtype == Int64 |
232 | | - and feature_views[0].features[1].name == "fs1_my_feature_2" |
233 | | - and feature_views[0].features[1].dtype == String |
234 | | - and feature_views[0].features[2].name == "fs1_my_feature_3" |
235 | | - and feature_views[0].features[2].dtype == Array(String) |
236 | | - and feature_views[0].features[3].name == "fs1_my_feature_4" |
237 | | - and feature_views[0].features[3].dtype == Array(Bytes) |
238 | | - and feature_views[0].entities[0] == "fs1_my_entity_1" |
| 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" |
239 | 238 | ) |
240 | 239 |
|
241 | 240 | feature_view = sql_registry.get_feature_view("my_feature_view_1", project) |
242 | 241 | assert ( |
243 | | - feature_view.name == "my_feature_view_1" |
244 | | - and feature_view.features[0].name == "fs1_my_feature_1" |
245 | | - and feature_view.features[0].dtype == Int64 |
246 | | - and feature_view.features[1].name == "fs1_my_feature_2" |
247 | | - and feature_view.features[1].dtype == String |
248 | | - and feature_view.features[2].name == "fs1_my_feature_3" |
249 | | - and feature_view.features[2].dtype == Array(String) |
250 | | - and feature_view.features[3].name == "fs1_my_feature_4" |
251 | | - and feature_view.features[3].dtype == Array(Bytes) |
252 | | - and feature_view.entities[0] == "fs1_my_entity_1" |
| 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" |
253 | 252 | ) |
254 | 253 | assert feature_view.ttl == timedelta(minutes=5) |
255 | 254 |
|
@@ -339,19 +338,19 @@ def location_features_from_push(inputs: pd.DataFrame) -> pd.DataFrame: |
339 | 338 |
|
340 | 339 | # List Feature Views |
341 | 340 | assert ( |
342 | | - len(feature_views) == 1 |
343 | | - and feature_views[0].name == "location_features_from_push" |
344 | | - and feature_views[0].features[0].name == "first_char" |
345 | | - and feature_views[0].features[0].dtype == String |
| 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 |
346 | 345 | ) |
347 | 346 |
|
348 | 347 | feature_view = sql_registry.get_on_demand_feature_view( |
349 | 348 | "location_features_from_push", project |
350 | 349 | ) |
351 | 350 | assert ( |
352 | | - feature_view.name == "location_features_from_push" |
353 | | - and feature_view.features[0].name == "first_char" |
354 | | - and feature_view.features[0].dtype == String |
| 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 |
355 | 354 | ) |
356 | 355 |
|
357 | 356 | sql_registry.delete_feature_view("location_features_from_push", project) |
@@ -441,51 +440,51 @@ def odfv1(feature_df: pd.DataFrame) -> pd.DataFrame: |
441 | 440 | on_demand_feature_views = sql_registry.list_on_demand_feature_views(project) |
442 | 441 |
|
443 | 442 | assert ( |
444 | | - len(on_demand_feature_views) == 1 |
445 | | - and on_demand_feature_views[0].name == "odfv1" |
446 | | - and on_demand_feature_views[0].features[0].name == "odfv1_my_feature_1" |
447 | | - and on_demand_feature_views[0].features[0].dtype == Float32 |
448 | | - and on_demand_feature_views[0].features[1].name == "odfv1_my_feature_2" |
449 | | - and on_demand_feature_views[0].features[1].dtype == Int32 |
| 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 |
450 | 449 | ) |
451 | 450 | request_schema = on_demand_feature_views[0].get_request_data_schema() |
452 | 451 | assert ( |
453 | | - list(request_schema.keys())[0] == "my_input_1" |
454 | | - and list(request_schema.values())[0] == ValueType.INT32 |
| 452 | + list(request_schema.keys())[0] == "my_input_1" |
| 453 | + and list(request_schema.values())[0] == ValueType.INT32 |
455 | 454 | ) |
456 | 455 |
|
457 | 456 | feature_view = sql_registry.get_on_demand_feature_view("odfv1", project) |
458 | 457 | assert ( |
459 | | - feature_view.name == "odfv1" |
460 | | - and feature_view.features[0].name == "odfv1_my_feature_1" |
461 | | - and feature_view.features[0].dtype == Float32 |
462 | | - and feature_view.features[1].name == "odfv1_my_feature_2" |
463 | | - and feature_view.features[1].dtype == Int32 |
| 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 |
464 | 463 | ) |
465 | 464 | request_schema = feature_view.get_request_data_schema() |
466 | 465 | assert ( |
467 | | - list(request_schema.keys())[0] == "my_input_1" |
468 | | - and list(request_schema.values())[0] == ValueType.INT32 |
| 466 | + list(request_schema.keys())[0] == "my_input_1" |
| 467 | + and list(request_schema.values())[0] == ValueType.INT32 |
469 | 468 | ) |
470 | 469 |
|
471 | 470 | # Make sure fv1 is untouched |
472 | 471 | feature_views = sql_registry.list_feature_views(project) |
473 | 472 |
|
474 | 473 | # List Feature Views |
475 | 474 | assert ( |
476 | | - len(feature_views) == 1 |
477 | | - and feature_views[0].name == "my_feature_view_1" |
478 | | - and feature_views[0].features[0].name == "fs1_my_feature_1" |
479 | | - and feature_views[0].features[0].dtype == Int64 |
480 | | - and feature_views[0].entities[0] == "fs1_my_entity_1" |
| 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" |
481 | 480 | ) |
482 | 481 |
|
483 | 482 | feature_view = sql_registry.get_feature_view("my_feature_view_1", project) |
484 | 483 | assert ( |
485 | | - feature_view.name == "my_feature_view_1" |
486 | | - and feature_view.features[0].name == "fs1_my_feature_1" |
487 | | - and feature_view.features[0].dtype == Int64 |
488 | | - and feature_view.entities[0] == "fs1_my_entity_1" |
| 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" |
489 | 488 | ) |
490 | 489 |
|
491 | 490 | sql_registry.teardown() |
|
0 commit comments