Skip to content

Commit

Permalink
test: order tests like source
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Apr 21, 2023
1 parent d4b8156 commit 6ced056
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from safeds.data.tabular.transformation import OneHotEncoder


class TestInverseTransformTableOnOneHotEncoder:
class TestInverseTransformTable:
@pytest.mark.parametrize(
("table_to_fit", "column_names", "table_to_transform"),
[
Expand Down
60 changes: 30 additions & 30 deletions tests/safeds/data/tabular/containers/_table/test_transform_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,6 @@


class TestTransform:
def test_should_raise_if_column_not_found(self) -> None:
table_to_fit = Table.from_dict(
{
"col1": ["a", "b", "c"],
},
)

transformer = OneHotEncoder().fit(table_to_fit, None)

table_to_transform = Table.from_dict(
{
"col2": ["a", "b", "c"],
},
)

with pytest.raises(UnknownColumnNameError):
table_to_transform.transform_table(transformer)

def test_should_raise_if_not_fitted(self) -> None:
table = Table.from_dict(
{
"col1": ["a", "b", "c"],
},
)

transformer = OneHotEncoder()

with pytest.raises(TransformerNotFittedError):
table.transform_table(transformer)

@pytest.mark.parametrize(
("table", "column_names", "expected"),
[
Expand Down Expand Up @@ -118,3 +88,33 @@ def test_should_not_change_original_table(self) -> None:
)

assert table == expected

def test_should_raise_if_column_not_found(self) -> None:
table_to_fit = Table.from_dict(
{
"col1": ["a", "b", "c"],
},
)

transformer = OneHotEncoder().fit(table_to_fit, None)

table_to_transform = Table.from_dict(
{
"col2": ["a", "b", "c"],
},
)

with pytest.raises(UnknownColumnNameError):
table_to_transform.transform_table(transformer)

def test_should_raise_if_not_fitted(self) -> None:
table = Table.from_dict(
{
"col1": ["a", "b", "c"],
},
)

transformer = OneHotEncoder()

with pytest.raises(TransformerNotFittedError):
table.transform_table(transformer)

0 comments on commit 6ced056

Please sign in to comment.