Skip to content

Commit 1e5706f

Browse files
committed
fixing tests
1 parent 17018de commit 1e5706f

File tree

3 files changed

+61
-3
lines changed

3 files changed

+61
-3
lines changed

python/tests/test_feature_group.py

+2
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ def test_save_report_true_default(self, mocker, dataframe_fixture_basic):
642642
storage=None,
643643
write_options={"wait_for_job": False},
644644
validation_options={"save_report": True},
645+
transformation_context=None,
645646
)
646647

647648
def test_save_report_default_overwritable(self, mocker, dataframe_fixture_basic):
@@ -677,6 +678,7 @@ def test_save_report_default_overwritable(self, mocker, dataframe_fixture_basic)
677678
storage=None,
678679
write_options={"wait_for_job": False},
679680
validation_options={"save_report": False},
681+
transformation_context=None,
680682
)
681683

682684

python/tests/test_feature_group_writer.py

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def test_fg_writer_context_manager(self, mocker, dataframe_fixture_basic):
4343
storage=None,
4444
write_options={"start_offline_materialization": False},
4545
validation_options={"fetch_expectation_suite": False},
46+
transformation_context=None,
4647
)
4748
assert fg._multi_part_insert is False
4849

python/tests/test_transformation_function.py

+58-3
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,15 @@ def test_func(col1):
381381
"test_func_col1_2",
382382
]
383383

384+
def test_generate_output_column_names_single_argument_multiple_output_type_odt(
385+
self,
386+
):
387+
@udf([int, float, int])
388+
def test_func(col1):
389+
return pd.DataFrame(
390+
{"col1": [col1 + 1], "col2": [col1 + 1], "col3": [col1 + 1]}
391+
)
392+
384393
odt = TransformationFunction(
385394
featurestore_id=10,
386395
hopsworks_udf=test_func,
@@ -420,6 +429,17 @@ def test_func(col1):
420429
"prefix_test_func_prefix_col1_2",
421430
]
422431

432+
def test_generate_output_column_names_single_argument_multiple_output_type_prefix_odt(
433+
self,
434+
):
435+
@udf([int, float, int])
436+
def test_func(col1):
437+
return pd.DataFrame(
438+
{"col1": [col1 + 1], "col2": [col1 + 1], "col3": [col1 + 1]}
439+
)
440+
441+
test_func._feature_name_prefix = "prefix_"
442+
423443
odt = TransformationFunction(
424444
featurestore_id=10,
425445
hopsworks_udf=test_func,
@@ -497,6 +517,17 @@ def test_func(col1, col2, col3):
497517
"prefix_test_func_prefix_col1_prefix_col2_prefix_col3_2",
498518
]
499519

520+
def test_generate_output_column_names_multiple_argument_multiple_output_type_prefix_odt(
521+
self,
522+
):
523+
@udf([int, float, int])
524+
def test_func(col1, col2, col3):
525+
return pd.DataFrame(
526+
{"col1": [col1 + 1], "col2": [col2 + 1], "col3": [col3 + 1]}
527+
)
528+
529+
test_func._feature_name_prefix = "prefix_"
530+
500531
odt = TransformationFunction(
501532
featurestore_id=10,
502533
hopsworks_udf=test_func,
@@ -911,7 +942,7 @@ def really_long_function_name_that_exceed_63_characters_causing_invalid_name_for
911942
"really_long_function_name_that_exceed_63_characters_causing_inv"
912943
]
913944

914-
def test_equality(self):
945+
def test_equality_mdt(self):
915946
@udf([int])
916947
def add_one(feature):
917948
return feature + 1
@@ -928,6 +959,13 @@ def add_one(feature):
928959
transformation_type=TransformationType.MODEL_DEPENDENT,
929960
)
930961

962+
assert mdt1 == mdt2
963+
964+
def test_equality_odt(self):
965+
@udf([int])
966+
def add_one(feature):
967+
return feature + 1
968+
931969
odt1 = TransformationFunction(
932970
featurestore_id=10,
933971
hopsworks_udf=add_one,
@@ -940,6 +978,23 @@ def add_one(feature):
940978
transformation_type=TransformationType.ON_DEMAND,
941979
)
942980

943-
assert mdt1 == mdt2
944981
assert odt1 == odt2
945-
assert mdt1 != odt1
982+
983+
def test_inequality(self):
984+
@udf([int])
985+
def add_one(feature):
986+
return feature + 1
987+
988+
mdt = TransformationFunction(
989+
featurestore_id=10,
990+
hopsworks_udf=add_one,
991+
transformation_type=TransformationType.MODEL_DEPENDENT,
992+
)
993+
994+
odt = TransformationFunction(
995+
featurestore_id=10,
996+
hopsworks_udf=add_one,
997+
transformation_type=TransformationType.ON_DEMAND,
998+
)
999+
1000+
assert mdt != odt

0 commit comments

Comments
 (0)