From 10b17fddca6518dd0d62da0a791c508659c994c4 Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Thu, 6 Apr 2023 18:30:29 +0200 Subject: [PATCH] feat: move exceptions into subpackages (#177) ### Summary of Changes * Move exceptions related to ML to `safeds.ml.exceptions`. * Move exceptions related to tabular data to `safeds.data.tabular.exceptions`. --- src/safeds/data/tabular/containers/_column.py | 4 ++-- src/safeds/data/tabular/containers/_row.py | 2 +- src/safeds/data/tabular/containers/_table.py | 4 ++-- .../{ => data/tabular}/exceptions/__init__.py | 16 ++-------------- .../tabular/exceptions/_exceptions.py} | 0 .../data/tabular/transformation/_imputer.py | 2 +- .../tabular/transformation/_label_encoder.py | 2 +- .../tabular/transformation/_one_hot_encoder.py | 2 +- src/safeds/data/tabular/typing/_schema.py | 2 +- src/safeds/ml/_util_sklearn.py | 2 +- src/safeds/ml/exceptions/__init__.py | 17 +++++++++++++++++ .../exceptions/_exceptions.py} | 0 src/safeds/ml/regression/_regressor.py | 2 +- .../tabular/containers/_column/test_boxplot.py | 2 +- .../containers/_column/test_correlation_with.py | 2 +- .../containers/_column/test_get_value.py | 2 +- .../tabular/containers/_column/test_getitem.py | 2 +- .../tabular/containers/_column/test_idness.py | 2 +- .../tabular/containers/_column/test_maximum.py | 2 +- .../tabular/containers/_column/test_mean.py | 2 +- .../tabular/containers/_column/test_median.py | 2 +- .../tabular/containers/_column/test_minimum.py | 2 +- .../_column/test_missing_value_ratio.py | 2 +- .../containers/_column/test_stability.py | 2 +- .../data/tabular/containers/_column/test_sum.py | 2 +- .../containers/_table/test_add_column.py | 2 +- .../tabular/containers/_table/test_add_row.py | 2 +- .../containers/_table/test_from_columns.py | 2 +- .../tabular/containers/_table/test_from_rows.py | 2 +- .../containers/_table/test_get_column.py | 2 +- .../tabular/containers/_table/test_get_row.py | 2 +- .../containers/_table/test_keep_only_columns.py | 2 +- .../tabular/containers/_table/test_lineplot.py | 2 +- .../containers/_table/test_remove_columns.py | 2 +- .../tabular/containers/_table/test_rename.py | 2 +- .../containers/_table/test_replace_column.py | 2 +- .../containers/_table/test_scatterplot.py | 2 +- .../containers/_table/test_table_add_column.py | 2 +- .../containers/_table/test_transform_column.py | 2 +- .../safeds/data/tabular/containers/test_row.py | 2 +- .../tabular/containers/test_tagged_table.py | 2 +- .../data/tabular/transformation/test_imputer.py | 2 +- .../transformation/test_label_encoder.py | 2 +- .../transformation/test_one_hot_encoder.py | 2 +- .../safeds/ml/classification/test_classifier.py | 14 +++++++------- tests/safeds/ml/regression/test_regressor.py | 4 ++-- 46 files changed, 70 insertions(+), 65 deletions(-) rename src/safeds/{ => data/tabular}/exceptions/__init__.py (58%) rename src/safeds/{exceptions/_data_exceptions.py => data/tabular/exceptions/_exceptions.py} (100%) create mode 100644 src/safeds/ml/exceptions/__init__.py rename src/safeds/{exceptions/_ml_exceptions.py => ml/exceptions/_exceptions.py} (100%) diff --git a/src/safeds/data/tabular/containers/_column.py b/src/safeds/data/tabular/containers/_column.py index 8b8cc7fab..2a846e03e 100644 --- a/src/safeds/data/tabular/containers/_column.py +++ b/src/safeds/data/tabular/containers/_column.py @@ -12,13 +12,13 @@ from safeds.data.image.containers import Image from safeds.data.image.typing import ImageFormat -from safeds.data.tabular.typing import ColumnType -from safeds.exceptions import ( +from safeds.data.tabular.exceptions import ( ColumnLengthMismatchError, ColumnSizeError, IndexOutOfBoundsError, NonNumericColumnError, ) +from safeds.data.tabular.typing import ColumnType if TYPE_CHECKING: from collections.abc import Callable, Iterable, Iterator diff --git a/src/safeds/data/tabular/containers/_row.py b/src/safeds/data/tabular/containers/_row.py index 2d954dc60..4d57c32cb 100644 --- a/src/safeds/data/tabular/containers/_row.py +++ b/src/safeds/data/tabular/containers/_row.py @@ -6,8 +6,8 @@ from IPython.core.display_functions import DisplayHandle, display from pandas.core.util.hashing import hash_pandas_object +from safeds.data.tabular.exceptions import UnknownColumnNameError from safeds.data.tabular.typing import ColumnType, Schema -from safeds.exceptions import UnknownColumnNameError class Row: diff --git a/src/safeds/data/tabular/containers/_table.py b/src/safeds/data/tabular/containers/_table.py index 6bcf1ec3c..001a49311 100644 --- a/src/safeds/data/tabular/containers/_table.py +++ b/src/safeds/data/tabular/containers/_table.py @@ -15,8 +15,7 @@ from safeds.data.image.containers import Image from safeds.data.image.typing import ImageFormat -from safeds.data.tabular.typing import ColumnType, Schema -from safeds.exceptions import ( +from safeds.data.tabular.exceptions import ( ColumnLengthMismatchError, ColumnSizeError, DuplicateColumnNameError, @@ -26,6 +25,7 @@ SchemaMismatchError, UnknownColumnNameError, ) +from safeds.data.tabular.typing import ColumnType, Schema from ._column import Column from ._row import Row diff --git a/src/safeds/exceptions/__init__.py b/src/safeds/data/tabular/exceptions/__init__.py similarity index 58% rename from src/safeds/exceptions/__init__.py rename to src/safeds/data/tabular/exceptions/__init__.py index ef89d1c10..0627c2922 100644 --- a/src/safeds/exceptions/__init__.py +++ b/src/safeds/data/tabular/exceptions/__init__.py @@ -1,6 +1,6 @@ -"""Custom exceptions that can be raised by the `safe-ds` package.""" +"""Custom exceptions that can be raised when working with tabular data.""" -from ._data_exceptions import ( +from ._exceptions import ( ColumnLengthMismatchError, ColumnSizeError, DuplicateColumnNameError, @@ -12,27 +12,15 @@ TransformerNotFittedError, UnknownColumnNameError, ) -from ._ml_exceptions import ( - DatasetContainsTargetError, - DatasetMissesFeaturesError, - LearningError, - ModelNotFittedError, - PredictionError, -) __all__ = [ "ColumnLengthMismatchError", "ColumnSizeError", - "DatasetContainsTargetError", - "DatasetMissesFeaturesError", "DuplicateColumnNameError", "IndexOutOfBoundsError", - "LearningError", "MissingDataError", "MissingSchemaError", - "ModelNotFittedError", "NonNumericColumnError", - "PredictionError", "SchemaMismatchError", "TransformerNotFittedError", "UnknownColumnNameError", diff --git a/src/safeds/exceptions/_data_exceptions.py b/src/safeds/data/tabular/exceptions/_exceptions.py similarity index 100% rename from src/safeds/exceptions/_data_exceptions.py rename to src/safeds/data/tabular/exceptions/_exceptions.py diff --git a/src/safeds/data/tabular/transformation/_imputer.py b/src/safeds/data/tabular/transformation/_imputer.py index efa4adf09..a0e2932be 100644 --- a/src/safeds/data/tabular/transformation/_imputer.py +++ b/src/safeds/data/tabular/transformation/_imputer.py @@ -6,9 +6,9 @@ from sklearn.impute import SimpleImputer as sk_SimpleImputer from safeds.data.tabular.containers import Table +from safeds.data.tabular.exceptions import TransformerNotFittedError, UnknownColumnNameError from safeds.data.tabular.transformation._table_transformer import TableTransformer from safeds.data.tabular.typing import ImputerStrategy -from safeds.exceptions import TransformerNotFittedError, UnknownColumnNameError class Imputer(TableTransformer): diff --git a/src/safeds/data/tabular/transformation/_label_encoder.py b/src/safeds/data/tabular/transformation/_label_encoder.py index 78ec96651..fe10fb35e 100644 --- a/src/safeds/data/tabular/transformation/_label_encoder.py +++ b/src/safeds/data/tabular/transformation/_label_encoder.py @@ -6,10 +6,10 @@ from sklearn.preprocessing import OrdinalEncoder as sk_OrdinalEncoder from safeds.data.tabular.containers import Table +from safeds.data.tabular.exceptions import TransformerNotFittedError, UnknownColumnNameError from safeds.data.tabular.transformation._table_transformer import ( InvertibleTableTransformer, ) -from safeds.exceptions import TransformerNotFittedError, UnknownColumnNameError def warn(*_: Any, **__: Any) -> None: diff --git a/src/safeds/data/tabular/transformation/_one_hot_encoder.py b/src/safeds/data/tabular/transformation/_one_hot_encoder.py index fe4cae099..a8a7af4c0 100644 --- a/src/safeds/data/tabular/transformation/_one_hot_encoder.py +++ b/src/safeds/data/tabular/transformation/_one_hot_encoder.py @@ -4,10 +4,10 @@ from sklearn.preprocessing import OneHotEncoder as sk_OneHotEncoder from safeds.data.tabular.containers import Table +from safeds.data.tabular.exceptions import TransformerNotFittedError, UnknownColumnNameError from safeds.data.tabular.transformation._table_transformer import ( InvertibleTableTransformer, ) -from safeds.exceptions import TransformerNotFittedError, UnknownColumnNameError class OneHotEncoder(InvertibleTableTransformer): diff --git a/src/safeds/data/tabular/typing/_schema.py b/src/safeds/data/tabular/typing/_schema.py index 910cf1aaf..aab54567e 100644 --- a/src/safeds/data/tabular/typing/_schema.py +++ b/src/safeds/data/tabular/typing/_schema.py @@ -3,8 +3,8 @@ from dataclasses import dataclass from typing import TYPE_CHECKING +from safeds.data.tabular.exceptions import UnknownColumnNameError from safeds.data.tabular.typing._column_type import ColumnType -from safeds.exceptions import UnknownColumnNameError if TYPE_CHECKING: import pandas as pd diff --git a/src/safeds/ml/_util_sklearn.py b/src/safeds/ml/_util_sklearn.py index 3219b0c8c..ea81efb3e 100644 --- a/src/safeds/ml/_util_sklearn.py +++ b/src/safeds/ml/_util_sklearn.py @@ -1,7 +1,7 @@ from typing import Any from safeds.data.tabular.containers import Table, TaggedTable -from safeds.exceptions import ( +from safeds.ml.exceptions import ( DatasetContainsTargetError, DatasetMissesFeaturesError, LearningError, diff --git a/src/safeds/ml/exceptions/__init__.py b/src/safeds/ml/exceptions/__init__.py new file mode 100644 index 000000000..c84e54ae2 --- /dev/null +++ b/src/safeds/ml/exceptions/__init__.py @@ -0,0 +1,17 @@ +"""Custom exceptions that can be raised when working with ML models.""" + +from ._exceptions import ( + DatasetContainsTargetError, + DatasetMissesFeaturesError, + LearningError, + ModelNotFittedError, + PredictionError, +) + +__all__ = [ + "DatasetContainsTargetError", + "DatasetMissesFeaturesError", + "LearningError", + "ModelNotFittedError", + "PredictionError", +] diff --git a/src/safeds/exceptions/_ml_exceptions.py b/src/safeds/ml/exceptions/_exceptions.py similarity index 100% rename from src/safeds/exceptions/_ml_exceptions.py rename to src/safeds/ml/exceptions/_exceptions.py diff --git a/src/safeds/ml/regression/_regressor.py b/src/safeds/ml/regression/_regressor.py index 4b051a3c0..8bcb7b423 100644 --- a/src/safeds/ml/regression/_regressor.py +++ b/src/safeds/ml/regression/_regressor.py @@ -6,7 +6,7 @@ from sklearn.metrics import mean_absolute_error as sk_mean_absolute_error from sklearn.metrics import mean_squared_error as sk_mean_squared_error -from safeds.exceptions import ColumnLengthMismatchError +from safeds.data.tabular.exceptions import ColumnLengthMismatchError if TYPE_CHECKING: from safeds.data.tabular.containers import Column, Table, TaggedTable diff --git a/tests/safeds/data/tabular/containers/_column/test_boxplot.py b/tests/safeds/data/tabular/containers/_column/test_boxplot.py index 591f245db..38694d769 100644 --- a/tests/safeds/data/tabular/containers/_column/test_boxplot.py +++ b/tests/safeds/data/tabular/containers/_column/test_boxplot.py @@ -3,7 +3,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Table -from safeds.exceptions import NonNumericColumnError +from safeds.data.tabular.exceptions import NonNumericColumnError def test_boxplot_complex() -> None: diff --git a/tests/safeds/data/tabular/containers/_column/test_correlation_with.py b/tests/safeds/data/tabular/containers/_column/test_correlation_with.py index 541ef0715..07965f951 100644 --- a/tests/safeds/data/tabular/containers/_column/test_correlation_with.py +++ b/tests/safeds/data/tabular/containers/_column/test_correlation_with.py @@ -1,7 +1,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Column -from safeds.exceptions import ColumnLengthMismatchError, NonNumericColumnError +from safeds.data.tabular.exceptions import ColumnLengthMismatchError, NonNumericColumnError def test_correlation_with() -> None: diff --git a/tests/safeds/data/tabular/containers/_column/test_get_value.py b/tests/safeds/data/tabular/containers/_column/test_get_value.py index 7d0a762f7..aefb740d9 100644 --- a/tests/safeds/data/tabular/containers/_column/test_get_value.py +++ b/tests/safeds/data/tabular/containers/_column/test_get_value.py @@ -1,7 +1,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Column -from safeds.exceptions import IndexOutOfBoundsError +from safeds.data.tabular.exceptions import IndexOutOfBoundsError def test_get_value_valid() -> None: diff --git a/tests/safeds/data/tabular/containers/_column/test_getitem.py b/tests/safeds/data/tabular/containers/_column/test_getitem.py index 7ecf5c752..d0b8a2806 100644 --- a/tests/safeds/data/tabular/containers/_column/test_getitem.py +++ b/tests/safeds/data/tabular/containers/_column/test_getitem.py @@ -1,7 +1,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Column -from safeds.exceptions import IndexOutOfBoundsError +from safeds.data.tabular.exceptions import IndexOutOfBoundsError def test_getitem_valid() -> None: diff --git a/tests/safeds/data/tabular/containers/_column/test_idness.py b/tests/safeds/data/tabular/containers/_column/test_idness.py index b30db61e1..5a8880591 100644 --- a/tests/safeds/data/tabular/containers/_column/test_idness.py +++ b/tests/safeds/data/tabular/containers/_column/test_idness.py @@ -1,7 +1,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Column -from safeds.exceptions import ColumnSizeError +from safeds.data.tabular.exceptions import ColumnSizeError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_column/test_maximum.py b/tests/safeds/data/tabular/containers/_column/test_maximum.py index 8756092f9..23a572f88 100644 --- a/tests/safeds/data/tabular/containers/_column/test_maximum.py +++ b/tests/safeds/data/tabular/containers/_column/test_maximum.py @@ -1,7 +1,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Table -from safeds.exceptions import NonNumericColumnError +from safeds.data.tabular.exceptions import NonNumericColumnError def test_maximum_invalid() -> None: diff --git a/tests/safeds/data/tabular/containers/_column/test_mean.py b/tests/safeds/data/tabular/containers/_column/test_mean.py index 753f7360e..f05e8e005 100644 --- a/tests/safeds/data/tabular/containers/_column/test_mean.py +++ b/tests/safeds/data/tabular/containers/_column/test_mean.py @@ -1,7 +1,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Table -from safeds.exceptions import NonNumericColumnError +from safeds.data.tabular.exceptions import NonNumericColumnError def test_mean_invalid() -> None: diff --git a/tests/safeds/data/tabular/containers/_column/test_median.py b/tests/safeds/data/tabular/containers/_column/test_median.py index 74cadd34d..bc0f6d6b3 100644 --- a/tests/safeds/data/tabular/containers/_column/test_median.py +++ b/tests/safeds/data/tabular/containers/_column/test_median.py @@ -1,7 +1,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Table -from safeds.exceptions import NonNumericColumnError +from safeds.data.tabular.exceptions import NonNumericColumnError def test_median_invalid() -> None: diff --git a/tests/safeds/data/tabular/containers/_column/test_minimum.py b/tests/safeds/data/tabular/containers/_column/test_minimum.py index 1261d1f3e..85a5eebc6 100644 --- a/tests/safeds/data/tabular/containers/_column/test_minimum.py +++ b/tests/safeds/data/tabular/containers/_column/test_minimum.py @@ -1,7 +1,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Table -from safeds.exceptions import NonNumericColumnError +from safeds.data.tabular.exceptions import NonNumericColumnError def test_minimum_invalid() -> None: diff --git a/tests/safeds/data/tabular/containers/_column/test_missing_value_ratio.py b/tests/safeds/data/tabular/containers/_column/test_missing_value_ratio.py index dff7f0c26..9c17b2053 100644 --- a/tests/safeds/data/tabular/containers/_column/test_missing_value_ratio.py +++ b/tests/safeds/data/tabular/containers/_column/test_missing_value_ratio.py @@ -2,7 +2,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Column -from safeds.exceptions import ColumnSizeError +from safeds.data.tabular.exceptions import ColumnSizeError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_column/test_stability.py b/tests/safeds/data/tabular/containers/_column/test_stability.py index 88cef0bdd..3e8ecdb6c 100644 --- a/tests/safeds/data/tabular/containers/_column/test_stability.py +++ b/tests/safeds/data/tabular/containers/_column/test_stability.py @@ -4,7 +4,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Column -from safeds.exceptions import ColumnSizeError +from safeds.data.tabular.exceptions import ColumnSizeError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_column/test_sum.py b/tests/safeds/data/tabular/containers/_column/test_sum.py index cb3898e83..cfd0b0723 100644 --- a/tests/safeds/data/tabular/containers/_column/test_sum.py +++ b/tests/safeds/data/tabular/containers/_column/test_sum.py @@ -1,7 +1,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Column -from safeds.exceptions import NonNumericColumnError +from safeds.data.tabular.exceptions import NonNumericColumnError def test_sum_valid() -> None: diff --git a/tests/safeds/data/tabular/containers/_table/test_add_column.py b/tests/safeds/data/tabular/containers/_table/test_add_column.py index b66cb7748..7db3d16b2 100644 --- a/tests/safeds/data/tabular/containers/_table/test_add_column.py +++ b/tests/safeds/data/tabular/containers/_table/test_add_column.py @@ -2,8 +2,8 @@ import pytest from _pytest.python_api import raises from safeds.data.tabular.containers import Column, Table +from safeds.data.tabular.exceptions import ColumnSizeError, DuplicateColumnNameError from safeds.data.tabular.typing import ColumnType, Integer, String -from safeds.exceptions import ColumnSizeError, DuplicateColumnNameError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_table/test_add_row.py b/tests/safeds/data/tabular/containers/_table/test_add_row.py index b31310794..662ec15a1 100644 --- a/tests/safeds/data/tabular/containers/_table/test_add_row.py +++ b/tests/safeds/data/tabular/containers/_table/test_add_row.py @@ -1,8 +1,8 @@ import pandas as pd from _pytest.python_api import raises from safeds.data.tabular.containers import Row, Table +from safeds.data.tabular.exceptions import SchemaMismatchError from safeds.data.tabular.typing import Integer, Schema, String -from safeds.exceptions import SchemaMismatchError def test_add_row_valid() -> None: diff --git a/tests/safeds/data/tabular/containers/_table/test_from_columns.py b/tests/safeds/data/tabular/containers/_table/test_from_columns.py index 62802d7da..7ce8add2f 100644 --- a/tests/safeds/data/tabular/containers/_table/test_from_columns.py +++ b/tests/safeds/data/tabular/containers/_table/test_from_columns.py @@ -1,7 +1,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Column, Table -from safeds.exceptions import MissingDataError +from safeds.data.tabular.exceptions import MissingDataError from tests.helpers import resolve_resource_path diff --git a/tests/safeds/data/tabular/containers/_table/test_from_rows.py b/tests/safeds/data/tabular/containers/_table/test_from_rows.py index 098de4eb4..65eacc902 100644 --- a/tests/safeds/data/tabular/containers/_table/test_from_rows.py +++ b/tests/safeds/data/tabular/containers/_table/test_from_rows.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Row, Table -from safeds.exceptions import MissingDataError +from safeds.data.tabular.exceptions import MissingDataError from tests.helpers import resolve_resource_path diff --git a/tests/safeds/data/tabular/containers/_table/test_get_column.py b/tests/safeds/data/tabular/containers/_table/test_get_column.py index baf2b9b59..8d61f763b 100644 --- a/tests/safeds/data/tabular/containers/_table/test_get_column.py +++ b/tests/safeds/data/tabular/containers/_table/test_get_column.py @@ -1,7 +1,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Column, Table -from safeds.exceptions import UnknownColumnNameError +from safeds.data.tabular.exceptions import UnknownColumnNameError def test_get_column_valid() -> None: diff --git a/tests/safeds/data/tabular/containers/_table/test_get_row.py b/tests/safeds/data/tabular/containers/_table/test_get_row.py index 7760dbc26..d3dbd2d70 100644 --- a/tests/safeds/data/tabular/containers/_table/test_get_row.py +++ b/tests/safeds/data/tabular/containers/_table/test_get_row.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Table -from safeds.exceptions import IndexOutOfBoundsError +from safeds.data.tabular.exceptions import IndexOutOfBoundsError from tests.helpers import resolve_resource_path diff --git a/tests/safeds/data/tabular/containers/_table/test_keep_only_columns.py b/tests/safeds/data/tabular/containers/_table/test_keep_only_columns.py index 972d08fd3..35688d1b6 100644 --- a/tests/safeds/data/tabular/containers/_table/test_keep_only_columns.py +++ b/tests/safeds/data/tabular/containers/_table/test_keep_only_columns.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Table -from safeds.exceptions import UnknownColumnNameError +from safeds.data.tabular.exceptions import UnknownColumnNameError from tests.helpers import resolve_resource_path diff --git a/tests/safeds/data/tabular/containers/_table/test_lineplot.py b/tests/safeds/data/tabular/containers/_table/test_lineplot.py index 5a28bc4f4..ed4ba963c 100644 --- a/tests/safeds/data/tabular/containers/_table/test_lineplot.py +++ b/tests/safeds/data/tabular/containers/_table/test_lineplot.py @@ -3,7 +3,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Table -from safeds.exceptions import UnknownColumnNameError +from safeds.data.tabular.exceptions import UnknownColumnNameError def test_lineplot(monkeypatch: _pytest.monkeypatch) -> None: diff --git a/tests/safeds/data/tabular/containers/_table/test_remove_columns.py b/tests/safeds/data/tabular/containers/_table/test_remove_columns.py index d26af85dd..dd50c4f8e 100644 --- a/tests/safeds/data/tabular/containers/_table/test_remove_columns.py +++ b/tests/safeds/data/tabular/containers/_table/test_remove_columns.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Table -from safeds.exceptions import UnknownColumnNameError +from safeds.data.tabular.exceptions import UnknownColumnNameError from tests.helpers import resolve_resource_path diff --git a/tests/safeds/data/tabular/containers/_table/test_rename.py b/tests/safeds/data/tabular/containers/_table/test_rename.py index bfc446eb4..7723ba3db 100644 --- a/tests/safeds/data/tabular/containers/_table/test_rename.py +++ b/tests/safeds/data/tabular/containers/_table/test_rename.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Table -from safeds.exceptions import DuplicateColumnNameError, UnknownColumnNameError +from safeds.data.tabular.exceptions import DuplicateColumnNameError, UnknownColumnNameError from tests.helpers import resolve_resource_path diff --git a/tests/safeds/data/tabular/containers/_table/test_replace_column.py b/tests/safeds/data/tabular/containers/_table/test_replace_column.py index 9430228b6..268cef1e1 100644 --- a/tests/safeds/data/tabular/containers/_table/test_replace_column.py +++ b/tests/safeds/data/tabular/containers/_table/test_replace_column.py @@ -1,7 +1,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Column, Table -from safeds.exceptions import ( +from safeds.data.tabular.exceptions import ( ColumnSizeError, DuplicateColumnNameError, UnknownColumnNameError, diff --git a/tests/safeds/data/tabular/containers/_table/test_scatterplot.py b/tests/safeds/data/tabular/containers/_table/test_scatterplot.py index 69c738924..4d04a2172 100644 --- a/tests/safeds/data/tabular/containers/_table/test_scatterplot.py +++ b/tests/safeds/data/tabular/containers/_table/test_scatterplot.py @@ -3,7 +3,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Table -from safeds.exceptions import UnknownColumnNameError +from safeds.data.tabular.exceptions import UnknownColumnNameError def test_scatterplot(monkeypatch: _pytest.monkeypatch) -> None: diff --git a/tests/safeds/data/tabular/containers/_table/test_table_add_column.py b/tests/safeds/data/tabular/containers/_table/test_table_add_column.py index 15014f02d..f64284aeb 100644 --- a/tests/safeds/data/tabular/containers/_table/test_table_add_column.py +++ b/tests/safeds/data/tabular/containers/_table/test_table_add_column.py @@ -1,7 +1,7 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Column, Table -from safeds.exceptions import ColumnSizeError, DuplicateColumnNameError +from safeds.data.tabular.exceptions import ColumnSizeError, DuplicateColumnNameError from tests.helpers import resolve_resource_path diff --git a/tests/safeds/data/tabular/containers/_table/test_transform_column.py b/tests/safeds/data/tabular/containers/_table/test_transform_column.py index b0474424c..304ceaa5c 100644 --- a/tests/safeds/data/tabular/containers/_table/test_transform_column.py +++ b/tests/safeds/data/tabular/containers/_table/test_transform_column.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Table -from safeds.exceptions import UnknownColumnNameError +from safeds.data.tabular.exceptions import UnknownColumnNameError from tests.helpers import resolve_resource_path diff --git a/tests/safeds/data/tabular/containers/test_row.py b/tests/safeds/data/tabular/containers/test_row.py index 5607fcd21..839e25b62 100644 --- a/tests/safeds/data/tabular/containers/test_row.py +++ b/tests/safeds/data/tabular/containers/test_row.py @@ -2,8 +2,8 @@ import pytest from safeds.data.tabular.containers import Row, Table +from safeds.data.tabular.exceptions import UnknownColumnNameError from safeds.data.tabular.typing import ColumnType, Integer, Schema, String -from safeds.exceptions import UnknownColumnNameError class TestInit: diff --git a/tests/safeds/data/tabular/containers/test_tagged_table.py b/tests/safeds/data/tabular/containers/test_tagged_table.py index 74e3467cd..9a817dd5c 100644 --- a/tests/safeds/data/tabular/containers/test_tagged_table.py +++ b/tests/safeds/data/tabular/containers/test_tagged_table.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Column, Table, TaggedTable -from safeds.exceptions import UnknownColumnNameError +from safeds.data.tabular.exceptions import UnknownColumnNameError @pytest.fixture() diff --git a/tests/safeds/data/tabular/transformation/test_imputer.py b/tests/safeds/data/tabular/transformation/test_imputer.py index daf661246..38718f425 100644 --- a/tests/safeds/data/tabular/transformation/test_imputer.py +++ b/tests/safeds/data/tabular/transformation/test_imputer.py @@ -1,8 +1,8 @@ import pytest from safeds.data.tabular.containers import Column, Table +from safeds.data.tabular.exceptions import TransformerNotFittedError, UnknownColumnNameError from safeds.data.tabular.transformation import Imputer from safeds.data.tabular.typing import ImputerStrategy -from safeds.exceptions import TransformerNotFittedError, UnknownColumnNameError class TestFit: diff --git a/tests/safeds/data/tabular/transformation/test_label_encoder.py b/tests/safeds/data/tabular/transformation/test_label_encoder.py index 59d7d0d0f..d9930f772 100644 --- a/tests/safeds/data/tabular/transformation/test_label_encoder.py +++ b/tests/safeds/data/tabular/transformation/test_label_encoder.py @@ -1,7 +1,7 @@ import pytest from safeds.data.tabular.containers import Column, Table +from safeds.data.tabular.exceptions import TransformerNotFittedError, UnknownColumnNameError from safeds.data.tabular.transformation import LabelEncoder -from safeds.exceptions import TransformerNotFittedError, UnknownColumnNameError class TestFit: diff --git a/tests/safeds/data/tabular/transformation/test_one_hot_encoder.py b/tests/safeds/data/tabular/transformation/test_one_hot_encoder.py index 212e83db2..7303ab5bc 100644 --- a/tests/safeds/data/tabular/transformation/test_one_hot_encoder.py +++ b/tests/safeds/data/tabular/transformation/test_one_hot_encoder.py @@ -1,7 +1,7 @@ import pytest from safeds.data.tabular.containers import Column, Table +from safeds.data.tabular.exceptions import TransformerNotFittedError, UnknownColumnNameError from safeds.data.tabular.transformation import OneHotEncoder -from safeds.exceptions import TransformerNotFittedError, UnknownColumnNameError class TestFit: diff --git a/tests/safeds/ml/classification/test_classifier.py b/tests/safeds/ml/classification/test_classifier.py index 09b148a74..b83791803 100644 --- a/tests/safeds/ml/classification/test_classifier.py +++ b/tests/safeds/ml/classification/test_classifier.py @@ -5,13 +5,6 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Column, Table, TaggedTable -from safeds.exceptions import ( - DatasetContainsTargetError, - DatasetMissesFeaturesError, - LearningError, - ModelNotFittedError, - PredictionError, -) from safeds.ml.classification import ( AdaBoost, Classifier, @@ -21,6 +14,13 @@ LogisticRegression, RandomForest, ) +from safeds.ml.exceptions import ( + DatasetContainsTargetError, + DatasetMissesFeaturesError, + LearningError, + ModelNotFittedError, + PredictionError, +) if TYPE_CHECKING: from _pytest.fixtures import FixtureRequest diff --git a/tests/safeds/ml/regression/test_regressor.py b/tests/safeds/ml/regression/test_regressor.py index 914b8b658..05304eedd 100644 --- a/tests/safeds/ml/regression/test_regressor.py +++ b/tests/safeds/ml/regression/test_regressor.py @@ -5,8 +5,8 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Column, Table, TaggedTable -from safeds.exceptions import ( - ColumnLengthMismatchError, +from safeds.data.tabular.exceptions import ColumnLengthMismatchError +from safeds.ml.exceptions import ( DatasetContainsTargetError, DatasetMissesFeaturesError, LearningError,