Skip to content

Commit

Permalink
added test to test_range_scaler.py to check if the minimum and maximu…
Browse files Browse the repository at this point in the history
…m parameters work correctly
  • Loading branch information
sibre28 committed May 19, 2023
1 parent c123e59 commit 6d5f699
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/safeds/data/tabular/transformation/test_range_scaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,47 @@ def test_should_return_transformed_table(
) -> None:
assert RangeScaler().fit_and_transform(table, column_names) == expected

@pytest.mark.parametrize(
("table", "column_names", "expected"),
[
(
Table(
{
"col1": [0.0, 5.0, 5.0, 10.0],
},
),
None,
Table(
{
"col1": [-10.0, 0.0, 0.0, 10.0],
},
),
),
(
Table(
{
"col1": [0.0, 5.0, 5.0, 10.0],
"col2": [0.0, 5.0, 5.0, 10.0],
},
),
["col1"],
Table(
{
"col1": [-10.0, 0.0, 0.0, 10.0],
"col2": [0.0, 5.0, 5.0, 10.0],
},
),
),
],
)
def test_should_return_transformed_table_with_correct_range(
self,
table: Table,
column_names: list[str] | None,
expected: Table,
) -> None:
assert RangeScaler(minimum=-10.0, maximum=10.0).fit_and_transform(table, column_names) == expected

def test_should_not_change_original_table(self) -> None:
table = Table(
{
Expand Down

0 comments on commit 6d5f699

Please sign in to comment.