Skip to content

Commit

Permalink
Add a test for the error when there's an unrecognized feature selecti…
Browse files Browse the repository at this point in the history
…on transform
  • Loading branch information
riley-harper committed Aug 26, 2024
1 parent cbc2654 commit b1a08ab
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions hlink/tests/core/transforms_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,16 @@ def test_generate_transforms_override_column_b(
Row(id=2, mother_nativity=0, test_override_column=-1, mbpl_range=-1),
Row(id=3, mother_nativity=6, test_override_column=-1, mbpl_range=-1),
]


@pytest.mark.parametrize("is_a", [True, False])
def test_generate_transforms_error_when_unrecognized_transform(
spark: SparkSession, preprocessing: LinkTask, is_a: bool
) -> None:
feature_selections = [
{"input_column": "age", "output_column": "age2", "transform": "not_supported"}
]
df = spark.createDataFrame([], "id:integer, age:integer")

with pytest.raises(ValueError, match="Invalid transform type"):
generate_transforms(spark, df, feature_selections, preprocessing, is_a, "id")

0 comments on commit b1a08ab

Please sign in to comment.