From 6ced056df1331916b497d9bf45fc50116dbec186 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Fri, 21 Apr 2023 19:58:32 +0200 Subject: [PATCH] test: order tests like source --- .../_table/test_inverse_transform_table.py | 2 +- .../containers/_table/test_transform_table.py | 60 +++++++++---------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/tests/safeds/data/tabular/containers/_table/test_inverse_transform_table.py b/tests/safeds/data/tabular/containers/_table/test_inverse_transform_table.py index 84ee05527..8d49a0474 100644 --- a/tests/safeds/data/tabular/containers/_table/test_inverse_transform_table.py +++ b/tests/safeds/data/tabular/containers/_table/test_inverse_transform_table.py @@ -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"), [ diff --git a/tests/safeds/data/tabular/containers/_table/test_transform_table.py b/tests/safeds/data/tabular/containers/_table/test_transform_table.py index 200740047..59ffe90d3 100644 --- a/tests/safeds/data/tabular/containers/_table/test_transform_table.py +++ b/tests/safeds/data/tabular/containers/_table/test_transform_table.py @@ -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"), [ @@ -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)