diff --git a/src/safeds/data/tabular/containers/_column.py b/src/safeds/data/tabular/containers/_column.py index 52704edf8..5988cba0f 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.exceptions import ( +from safeds.data.tabular.typing import ColumnType +from safeds.exceptions import ( ColumnLengthMismatchError, ColumnSizeError, IndexOutOfBoundsError, NonNumericColumnError, ) -from safeds.data.tabular.typing import ColumnType if TYPE_CHECKING: from collections.abc import Callable, Iterator diff --git a/src/safeds/data/tabular/containers/_row.py b/src/safeds/data/tabular/containers/_row.py index e215fdff7..0e338caed 100644 --- a/src/safeds/data/tabular/containers/_row.py +++ b/src/safeds/data/tabular/containers/_row.py @@ -5,8 +5,8 @@ import pandas as pd -from safeds.data.tabular.exceptions import UnknownColumnNameError from safeds.data.tabular.typing import ColumnType, Schema +from safeds.exceptions import UnknownColumnNameError if TYPE_CHECKING: from collections.abc import Iterator diff --git a/src/safeds/data/tabular/containers/_table.py b/src/safeds/data/tabular/containers/_table.py index e4b66bbce..59c4ad01b 100644 --- a/src/safeds/data/tabular/containers/_table.py +++ b/src/safeds/data/tabular/containers/_table.py @@ -15,7 +15,8 @@ from safeds.data.image.containers import Image from safeds.data.image.typing import ImageFormat -from safeds.data.tabular.exceptions import ( +from safeds.data.tabular.typing import ColumnType, Schema +from safeds.exceptions import ( ColumnLengthMismatchError, ColumnSizeError, DuplicateColumnNameError, @@ -24,7 +25,6 @@ SchemaMismatchError, UnknownColumnNameError, ) -from safeds.data.tabular.typing import ColumnType, Schema from ._column import Column from ._row import Row diff --git a/src/safeds/data/tabular/exceptions/__init__.py b/src/safeds/data/tabular/exceptions/__init__.py deleted file mode 100644 index accd4f4e3..000000000 --- a/src/safeds/data/tabular/exceptions/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -"""Custom exceptions that can be raised when working with tabular data.""" - -from ._exceptions import ( - ColumnLengthMismatchError, - ColumnSizeError, - DuplicateColumnNameError, - IndexOutOfBoundsError, - NonNumericColumnError, - SchemaMismatchError, - TransformerNotFittedError, - UnknownColumnNameError, -) - -__all__ = [ - "ColumnLengthMismatchError", - "ColumnSizeError", - "DuplicateColumnNameError", - "IndexOutOfBoundsError", - "NonNumericColumnError", - "SchemaMismatchError", - "TransformerNotFittedError", - "UnknownColumnNameError", -] diff --git a/src/safeds/data/tabular/transformation/_imputer.py b/src/safeds/data/tabular/transformation/_imputer.py index e42eb75a4..4b1a40b25 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 55d426a0f..9293f9da3 100644 --- a/src/safeds/data/tabular/transformation/_label_encoder.py +++ b/src/safeds/data/tabular/transformation/_label_encoder.py @@ -3,10 +3,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 # noinspection PyProtectedMember diff --git a/src/safeds/data/tabular/transformation/_one_hot_encoder.py b/src/safeds/data/tabular/transformation/_one_hot_encoder.py index 80810cd78..ec3a38111 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 c9bd1996c..13c0f521a 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/exceptions/__init__.py b/src/safeds/exceptions/__init__.py new file mode 100644 index 000000000..3f2f703c0 --- /dev/null +++ b/src/safeds/exceptions/__init__.py @@ -0,0 +1,39 @@ +"""Custom exceptions that can be raised by Safe-DS.""" + +from safeds.exceptions._data import ( + ColumnLengthMismatchError, + ColumnSizeError, + DuplicateColumnNameError, + IndexOutOfBoundsError, + NonNumericColumnError, + SchemaMismatchError, + TransformerNotFittedError, + UnknownColumnNameError, +) +from safeds.exceptions._ml import ( + DatasetContainsTargetError, + DatasetMissesFeaturesError, + LearningError, + ModelNotFittedError, + PredictionError, + UntaggedTableError, +) + +__all__ = [ + # Data exceptions + "ColumnLengthMismatchError", + "ColumnSizeError", + "DuplicateColumnNameError", + "IndexOutOfBoundsError", + "NonNumericColumnError", + "SchemaMismatchError", + "TransformerNotFittedError", + "UnknownColumnNameError", + # ML exceptions + "DatasetContainsTargetError", + "DatasetMissesFeaturesError", + "LearningError", + "ModelNotFittedError", + "PredictionError", + "UntaggedTableError", +] diff --git a/src/safeds/data/tabular/exceptions/_exceptions.py b/src/safeds/exceptions/_data.py similarity index 100% rename from src/safeds/data/tabular/exceptions/_exceptions.py rename to src/safeds/exceptions/_data.py diff --git a/src/safeds/ml/exceptions/_exceptions.py b/src/safeds/exceptions/_ml.py similarity index 100% rename from src/safeds/ml/exceptions/_exceptions.py rename to src/safeds/exceptions/_ml.py diff --git a/src/safeds/ml/classical/_util_sklearn.py b/src/safeds/ml/classical/_util_sklearn.py index 762f3cc36..6b581c3d8 100644 --- a/src/safeds/ml/classical/_util_sklearn.py +++ b/src/safeds/ml/classical/_util_sklearn.py @@ -2,7 +2,7 @@ from typing import Any from safeds.data.tabular.containers import Table, TaggedTable -from safeds.ml.exceptions import ( +from safeds.exceptions import ( DatasetContainsTargetError, DatasetMissesFeaturesError, LearningError, diff --git a/src/safeds/ml/classical/classification/_classifier.py b/src/safeds/ml/classical/classification/_classifier.py index 5862f575c..71066128a 100644 --- a/src/safeds/ml/classical/classification/_classifier.py +++ b/src/safeds/ml/classical/classification/_classifier.py @@ -6,7 +6,7 @@ from sklearn.metrics import accuracy_score as sk_accuracy_score from safeds.data.tabular.containers import Table, TaggedTable -from safeds.ml.exceptions import UntaggedTableError +from safeds.exceptions import UntaggedTableError if TYPE_CHECKING: from typing import Any diff --git a/src/safeds/ml/classical/regression/_regressor.py b/src/safeds/ml/classical/regression/_regressor.py index 1e12f8a8f..682781e58 100644 --- a/src/safeds/ml/classical/regression/_regressor.py +++ b/src/safeds/ml/classical/regression/_regressor.py @@ -7,8 +7,7 @@ from sklearn.metrics import mean_squared_error as sk_mean_squared_error from safeds.data.tabular.containers import Column, Table, TaggedTable -from safeds.data.tabular.exceptions import ColumnLengthMismatchError -from safeds.ml.exceptions import UntaggedTableError +from safeds.exceptions import ColumnLengthMismatchError, UntaggedTableError if TYPE_CHECKING: from sklearn.base import RegressorMixin diff --git a/src/safeds/ml/exceptions/__init__.py b/src/safeds/ml/exceptions/__init__.py deleted file mode 100644 index 5cde6adfd..000000000 --- a/src/safeds/ml/exceptions/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -"""Custom exceptions that can be raised when working with ML models.""" - -from ._exceptions import ( - DatasetContainsTargetError, - DatasetMissesFeaturesError, - LearningError, - ModelNotFittedError, - PredictionError, - UntaggedTableError, -) - -__all__ = [ - "DatasetContainsTargetError", - "DatasetMissesFeaturesError", - "LearningError", - "ModelNotFittedError", - "PredictionError", - "UntaggedTableError", -] 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 285a01811..310b60adc 100644 --- a/tests/safeds/data/tabular/containers/_column/test_correlation_with.py +++ b/tests/safeds/data/tabular/containers/_column/test_correlation_with.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Column -from safeds.data.tabular.exceptions import ColumnLengthMismatchError, NonNumericColumnError +from safeds.exceptions import ColumnLengthMismatchError, NonNumericColumnError @pytest.mark.parametrize( 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 ec7a1ddf3..342ec8fb4 100644 --- a/tests/safeds/data/tabular/containers/_column/test_get_value.py +++ b/tests/safeds/data/tabular/containers/_column/test_get_value.py @@ -2,7 +2,7 @@ import pytest from safeds.data.tabular.containers import Column -from safeds.data.tabular.exceptions import IndexOutOfBoundsError +from safeds.exceptions import IndexOutOfBoundsError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_column/test_getitem.py b/tests/safeds/data/tabular/containers/_column/test_getitem.py index f49db7769..fe29f0af2 100644 --- a/tests/safeds/data/tabular/containers/_column/test_getitem.py +++ b/tests/safeds/data/tabular/containers/_column/test_getitem.py @@ -2,7 +2,7 @@ import pytest from safeds.data.tabular.containers import Column -from safeds.data.tabular.exceptions import IndexOutOfBoundsError +from safeds.exceptions import IndexOutOfBoundsError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_column/test_idness.py b/tests/safeds/data/tabular/containers/_column/test_idness.py index d6766cbe2..b1deba798 100644 --- a/tests/safeds/data/tabular/containers/_column/test_idness.py +++ b/tests/safeds/data/tabular/containers/_column/test_idness.py @@ -2,7 +2,7 @@ import pytest from safeds.data.tabular.containers import Column -from safeds.data.tabular.exceptions import ColumnSizeError +from safeds.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 e2e00fb68..7988a0eab 100644 --- a/tests/safeds/data/tabular/containers/_column/test_maximum.py +++ b/tests/safeds/data/tabular/containers/_column/test_maximum.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Column -from safeds.data.tabular.exceptions import NonNumericColumnError +from safeds.exceptions import NonNumericColumnError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_column/test_mean.py b/tests/safeds/data/tabular/containers/_column/test_mean.py index faad9aad0..7b4859be3 100644 --- a/tests/safeds/data/tabular/containers/_column/test_mean.py +++ b/tests/safeds/data/tabular/containers/_column/test_mean.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Column -from safeds.data.tabular.exceptions import NonNumericColumnError +from safeds.exceptions import NonNumericColumnError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_column/test_median.py b/tests/safeds/data/tabular/containers/_column/test_median.py index 4ef27ec8a..7d81b15df 100644 --- a/tests/safeds/data/tabular/containers/_column/test_median.py +++ b/tests/safeds/data/tabular/containers/_column/test_median.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Column -from safeds.data.tabular.exceptions import NonNumericColumnError +from safeds.exceptions import NonNumericColumnError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_column/test_minimum.py b/tests/safeds/data/tabular/containers/_column/test_minimum.py index a57e5b2d0..d8afe4bcc 100644 --- a/tests/safeds/data/tabular/containers/_column/test_minimum.py +++ b/tests/safeds/data/tabular/containers/_column/test_minimum.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Column -from safeds.data.tabular.exceptions import NonNumericColumnError +from safeds.exceptions import NonNumericColumnError @pytest.mark.parametrize( 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 204092811..3d8856663 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 pytest from safeds.data.tabular.containers import Column -from safeds.data.tabular.exceptions import ColumnSizeError +from safeds.exceptions import ColumnSizeError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_column/test_plot_boxplot.py b/tests/safeds/data/tabular/containers/_column/test_plot_boxplot.py index 8f013c974..8d9212f59 100644 --- a/tests/safeds/data/tabular/containers/_column/test_plot_boxplot.py +++ b/tests/safeds/data/tabular/containers/_column/test_plot_boxplot.py @@ -1,7 +1,7 @@ import pytest from safeds.data.image.containers import Image from safeds.data.tabular.containers import Table -from safeds.data.tabular.exceptions import NonNumericColumnError +from safeds.exceptions import NonNumericColumnError from tests.helpers import resolve_resource_path diff --git a/tests/safeds/data/tabular/containers/_column/test_stability.py b/tests/safeds/data/tabular/containers/_column/test_stability.py index 6207c639b..d1bb893d2 100644 --- a/tests/safeds/data/tabular/containers/_column/test_stability.py +++ b/tests/safeds/data/tabular/containers/_column/test_stability.py @@ -2,7 +2,7 @@ import pytest from safeds.data.tabular.containers import Column -from safeds.data.tabular.exceptions import ColumnSizeError +from safeds.exceptions import ColumnSizeError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_column/test_standard_deviation.py b/tests/safeds/data/tabular/containers/_column/test_standard_deviation.py index bbde9ab2d..48aaf0e4a 100644 --- a/tests/safeds/data/tabular/containers/_column/test_standard_deviation.py +++ b/tests/safeds/data/tabular/containers/_column/test_standard_deviation.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Column -from safeds.data.tabular.exceptions import NonNumericColumnError +from safeds.exceptions import NonNumericColumnError @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 57c529851..c4401f96e 100644 --- a/tests/safeds/data/tabular/containers/_column/test_sum.py +++ b/tests/safeds/data/tabular/containers/_column/test_sum.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Column -from safeds.data.tabular.exceptions import NonNumericColumnError +from safeds.exceptions import NonNumericColumnError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_column/test_variance.py b/tests/safeds/data/tabular/containers/_column/test_variance.py index 46ace0672..9bddbe400 100644 --- a/tests/safeds/data/tabular/containers/_column/test_variance.py +++ b/tests/safeds/data/tabular/containers/_column/test_variance.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Column -from safeds.data.tabular.exceptions import NonNumericColumnError +from safeds.exceptions import NonNumericColumnError @pytest.mark.parametrize( 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 9dd2d9af4..111be80c6 100644 --- a/tests/safeds/data/tabular/containers/_table/test_add_column.py +++ b/tests/safeds/data/tabular/containers/_table/test_add_column.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Column, Table -from safeds.data.tabular.exceptions import ColumnSizeError, DuplicateColumnNameError +from safeds.exceptions import ColumnSizeError, DuplicateColumnNameError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_table/test_add_columns.py b/tests/safeds/data/tabular/containers/_table/test_add_columns.py index dffe8a9ec..6647e6492 100644 --- a/tests/safeds/data/tabular/containers/_table/test_add_columns.py +++ b/tests/safeds/data/tabular/containers/_table/test_add_columns.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Column, Table -from safeds.data.tabular.exceptions import ColumnSizeError, DuplicateColumnNameError +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 994b24c23..a0a222995 100644 --- a/tests/safeds/data/tabular/containers/_table/test_add_row.py +++ b/tests/safeds/data/tabular/containers/_table/test_add_row.py @@ -1,7 +1,7 @@ import pytest from _pytest.python_api import raises from safeds.data.tabular.containers import Row, Table -from safeds.data.tabular.exceptions import SchemaMismatchError +from safeds.exceptions import SchemaMismatchError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_table/test_add_rows.py b/tests/safeds/data/tabular/containers/_table/test_add_rows.py index cf96733b6..01e918b03 100644 --- a/tests/safeds/data/tabular/containers/_table/test_add_rows.py +++ b/tests/safeds/data/tabular/containers/_table/test_add_rows.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Row, Table -from safeds.data.tabular.exceptions import SchemaMismatchError +from safeds.exceptions import SchemaMismatchError @pytest.mark.parametrize( 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 2b574822f..d56bd54af 100644 --- a/tests/safeds/data/tabular/containers/_table/test_from_columns.py +++ b/tests/safeds/data/tabular/containers/_table/test_from_columns.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Column, Table -from safeds.data.tabular.exceptions import ColumnLengthMismatchError +from safeds.exceptions import ColumnLengthMismatchError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_table/test_from_dict.py b/tests/safeds/data/tabular/containers/_table/test_from_dict.py index a39e60be9..724b4ad68 100644 --- a/tests/safeds/data/tabular/containers/_table/test_from_dict.py +++ b/tests/safeds/data/tabular/containers/_table/test_from_dict.py @@ -2,7 +2,7 @@ import pytest from safeds.data.tabular.containers import Table -from safeds.data.tabular.exceptions import ColumnLengthMismatchError +from safeds.exceptions import ColumnLengthMismatchError @pytest.mark.parametrize( 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 781239201..0ae2d7d31 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.data.tabular.exceptions import SchemaMismatchError +from safeds.exceptions import SchemaMismatchError @pytest.mark.parametrize( 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 4ee938ef2..7dccc4adc 100644 --- a/tests/safeds/data/tabular/containers/_table/test_get_column.py +++ b/tests/safeds/data/tabular/containers/_table/test_get_column.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Column, Table -from safeds.data.tabular.exceptions import UnknownColumnNameError +from safeds.exceptions import UnknownColumnNameError @pytest.mark.parametrize( 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 8d6f5a821..2c5087785 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 Row, Table -from safeds.data.tabular.exceptions import IndexOutOfBoundsError +from safeds.exceptions import IndexOutOfBoundsError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_table/test_init.py b/tests/safeds/data/tabular/containers/_table/test_init.py index 5af42c6ff..aa5265869 100644 --- a/tests/safeds/data/tabular/containers/_table/test_init.py +++ b/tests/safeds/data/tabular/containers/_table/test_init.py @@ -1,7 +1,7 @@ import pytest from safeds.data.tabular.containers import Table -from safeds.data.tabular.exceptions import ColumnLengthMismatchError from safeds.data.tabular.typing import Integer, Schema +from safeds.exceptions import ColumnLengthMismatchError @pytest.mark.parametrize( 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 6d73ccc87..92d0e0af6 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 @@ -1,7 +1,7 @@ import pytest from safeds.data.tabular.containers import Table -from safeds.data.tabular.exceptions import TransformerNotFittedError from safeds.data.tabular.transformation import OneHotEncoder +from safeds.exceptions import TransformerNotFittedError @pytest.mark.parametrize( 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 9a7da072c..a4a1ff723 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.data.tabular.exceptions import UnknownColumnNameError +from safeds.exceptions import UnknownColumnNameError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_table/test_plot_lineplot.py b/tests/safeds/data/tabular/containers/_table/test_plot_lineplot.py index e33a5e81f..a370c3146 100644 --- a/tests/safeds/data/tabular/containers/_table/test_plot_lineplot.py +++ b/tests/safeds/data/tabular/containers/_table/test_plot_lineplot.py @@ -1,7 +1,7 @@ import pytest from safeds.data.image.containers import Image from safeds.data.tabular.containers import Table -from safeds.data.tabular.exceptions import UnknownColumnNameError +from safeds.exceptions import UnknownColumnNameError from tests.helpers import resolve_resource_path diff --git a/tests/safeds/data/tabular/containers/_table/test_plot_scatterplot.py b/tests/safeds/data/tabular/containers/_table/test_plot_scatterplot.py index 43d0787bd..0ff0ed090 100644 --- a/tests/safeds/data/tabular/containers/_table/test_plot_scatterplot.py +++ b/tests/safeds/data/tabular/containers/_table/test_plot_scatterplot.py @@ -1,7 +1,7 @@ import pytest from safeds.data.image.containers import Image from safeds.data.tabular.containers import Table -from safeds.data.tabular.exceptions import UnknownColumnNameError +from safeds.exceptions import UnknownColumnNameError from tests.helpers import resolve_resource_path 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 7f8377f72..f0a47fc18 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.data.tabular.exceptions import UnknownColumnNameError +from safeds.exceptions import UnknownColumnNameError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_table/test_rename.py b/tests/safeds/data/tabular/containers/_table/test_rename.py index 2a138594b..97b9fc376 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.data.tabular.exceptions import DuplicateColumnNameError, UnknownColumnNameError +from safeds.exceptions import DuplicateColumnNameError, UnknownColumnNameError @pytest.mark.parametrize( 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 6e1484fed..aeecb77e9 100644 --- a/tests/safeds/data/tabular/containers/_table/test_replace_column.py +++ b/tests/safeds/data/tabular/containers/_table/test_replace_column.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Column, Table -from safeds.data.tabular.exceptions import ( +from safeds.exceptions import ( ColumnSizeError, DuplicateColumnNameError, UnknownColumnNameError, diff --git a/tests/safeds/data/tabular/containers/_table/test_table.py b/tests/safeds/data/tabular/containers/_table/test_table.py deleted file mode 100644 index e540e0696..000000000 --- a/tests/safeds/data/tabular/containers/_table/test_table.py +++ /dev/null @@ -1,16 +0,0 @@ -import pandas as pd -from safeds.data.tabular.containers import Table -from safeds.data.tabular.typing import RealNumber, Schema - - -def test_should_create_empty_table() -> None: - table = Table._from_pandas_dataframe(pd.DataFrame(), Schema({"col1": RealNumber()})) - col = table.get_column("col1") - assert col.number_of_rows == 0 - assert isinstance(col.type, RealNumber) - assert col.name == "col1" - - -def test_should_create_empty_table_without_schema() -> None: - table = Table() - assert table.schema == Schema({}) 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 28e79cbd7..0707dcae2 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.data.tabular.exceptions import UnknownColumnNameError +from safeds.exceptions import UnknownColumnNameError @pytest.mark.parametrize( 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 007293ee8..fd5054e5b 100644 --- a/tests/safeds/data/tabular/containers/_table/test_transform_table.py +++ b/tests/safeds/data/tabular/containers/_table/test_transform_table.py @@ -1,7 +1,7 @@ import pytest from safeds.data.tabular.containers import Table -from safeds.data.tabular.exceptions import TransformerNotFittedError, UnknownColumnNameError from safeds.data.tabular.transformation import OneHotEncoder +from safeds.exceptions import TransformerNotFittedError, UnknownColumnNameError @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/test_row.py b/tests/safeds/data/tabular/containers/test_row.py index e8a2e1b3c..d4be01ace 100644 --- a/tests/safeds/data/tabular/containers/test_row.py +++ b/tests/safeds/data/tabular/containers/test_row.py @@ -4,8 +4,8 @@ import pandas as pd 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 TestFromDict: diff --git a/tests/safeds/data/tabular/containers/test_tagged_table.py b/tests/safeds/data/tabular/containers/test_tagged_table.py index b112a6b88..307450ccd 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.data.tabular.exceptions import UnknownColumnNameError +from safeds.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 e37901565..3608c2f76 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 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 TestStrategy: diff --git a/tests/safeds/data/tabular/transformation/test_label_encoder.py b/tests/safeds/data/tabular/transformation/test_label_encoder.py index b7352865d..8be5c4378 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 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 8d7766877..735ff57ff 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 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/data/tabular/typing/test_schema.py b/tests/safeds/data/tabular/typing/test_schema.py index dda39f66a..f4e827353 100644 --- a/tests/safeds/data/tabular/typing/test_schema.py +++ b/tests/safeds/data/tabular/typing/test_schema.py @@ -4,8 +4,8 @@ import pandas as pd import pytest -from safeds.data.tabular.exceptions import UnknownColumnNameError from safeds.data.tabular.typing import Boolean, ColumnType, Integer, RealNumber, Schema, String +from safeds.exceptions import UnknownColumnNameError if TYPE_CHECKING: from typing import Any diff --git a/tests/safeds/ml/classical/classification/test_classifier.py b/tests/safeds/ml/classical/classification/test_classifier.py index 1ce8ad88c..c198c46ac 100644 --- a/tests/safeds/ml/classical/classification/test_classifier.py +++ b/tests/safeds/ml/classical/classification/test_classifier.py @@ -4,6 +4,14 @@ import pytest from safeds.data.tabular.containers import Table, TaggedTable +from safeds.exceptions import ( + DatasetContainsTargetError, + DatasetMissesFeaturesError, + LearningError, + ModelNotFittedError, + PredictionError, + UntaggedTableError, +) from safeds.ml.classical.classification import ( AdaBoost, Classifier, @@ -14,14 +22,6 @@ RandomForest, SupportVectorMachine, ) -from safeds.ml.exceptions import ( - DatasetContainsTargetError, - DatasetMissesFeaturesError, - LearningError, - ModelNotFittedError, - PredictionError, - UntaggedTableError, -) if TYPE_CHECKING: from _pytest.fixtures import FixtureRequest diff --git a/tests/safeds/ml/classical/regression/test_regressor.py b/tests/safeds/ml/classical/regression/test_regressor.py index 7c1aa69a8..21aa4816d 100644 --- a/tests/safeds/ml/classical/regression/test_regressor.py +++ b/tests/safeds/ml/classical/regression/test_regressor.py @@ -5,7 +5,15 @@ import pandas as pd import pytest from safeds.data.tabular.containers import Column, Table, TaggedTable -from safeds.data.tabular.exceptions import ColumnLengthMismatchError +from safeds.exceptions import ( + ColumnLengthMismatchError, + DatasetContainsTargetError, + DatasetMissesFeaturesError, + LearningError, + ModelNotFittedError, + PredictionError, + UntaggedTableError, +) from safeds.ml.classical.regression import ( AdaBoost, DecisionTree, @@ -22,14 +30,6 @@ # noinspection PyProtectedMember from safeds.ml.classical.regression._regressor import _check_metrics_preconditions -from safeds.ml.exceptions import ( - DatasetContainsTargetError, - DatasetMissesFeaturesError, - LearningError, - ModelNotFittedError, - PredictionError, - UntaggedTableError, -) if TYPE_CHECKING: from _pytest.fixtures import FixtureRequest