From d608cdde5b3c487c4f951951ddc747caea06fe16 Mon Sep 17 00:00:00 2001 From: Gerhardsa0 Date: Tue, 12 Mar 2024 00:05:13 +0100 Subject: [PATCH 01/19] TimeSeries no longer subclass of TaggedTable this is not finished --- .../data/tabular/containers/_time_series.py | 53 ++++++++++++------- .../test_from_table_to_time_series.py | 15 +++++- 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/src/safeds/data/tabular/containers/_time_series.py b/src/safeds/data/tabular/containers/_time_series.py index a755885e1..989a76b60 100644 --- a/src/safeds/data/tabular/containers/_time_series.py +++ b/src/safeds/data/tabular/containers/_time_series.py @@ -23,7 +23,7 @@ from typing import Any -class TimeSeries(TaggedTable): +class TimeSeries(Table): # ------------------------------------------------------------------------------------------------------------------ # Creation @@ -108,8 +108,6 @@ def _from_table_to_time_series( ------ UnknownColumnNameError If target_name or time_name matches none of the column names. - Value Error - If there is no other column than the specified target and time columns left to be a feature column Value Error If one column is target and feature Value Error @@ -124,15 +122,27 @@ def _from_table_to_time_series( if feature_names is not None and time_name in feature_names: raise ValueError(f"Column '{time_name}' can not be time and feature column.") - if feature_names is None: - feature_names = table.column_names - if time_name in feature_names: - feature_names.remove(time_name) - if target_name in feature_names: - feature_names.remove(target_name) - tagged_table = TaggedTable._from_table(table=table, target_name=target_name, feature_names=feature_names) + if target_name not in table.column_names: + raise UnknownColumnNameError([target_name]) + + result = object.__new__(TimeSeries) + + result._data = table._data + result._schema = table._schema + result._time = table.get_column(time_name) + result._target = table.get_column(target_name) + if feature_names is not None: + result._feature_names = feature_names + result._features = table.keep_only_columns(feature_names) + else: + result._feature_names = None + result._features = None + + + + # check if time column got added as feature column - return TimeSeries._from_tagged_table(tagged_table=tagged_table, time_name=time_name) + return result # ------------------------------------------------------------------------------------------------------------------ # Dunder methods @@ -179,20 +189,23 @@ def __init__( """ _data = Table(data) - if feature_names is None: - feature_names = _data.column_names - if time_name in feature_names: - feature_names.remove(time_name) - if target_name in feature_names: - feature_names.remove(target_name) # Validate inputs - super().__init__(data, target_name, feature_names) + super().__init__(data) + if feature_names is None: + self._feature_names = None + self._features = None + else: + self._feature_names = feature_names + self._features = _data.keep_only_columns(feature_names) if time_name in feature_names: raise ValueError(f"Column '{time_name}' can not be time and feature column.") - if time_name not in (_data.column_names): + if target_name in feature_names: + raise ValueError(f"Column '{target_name}' can not be time and feature column.") + if time_name not in _data.column_names: raise UnknownColumnNameError([time_name]) self._time: Column = _data.get_column(time_name) + self._target: Column = _data.get_column(target_name) def __sizeof__(self) -> int: """ @@ -202,7 +215,7 @@ def __sizeof__(self) -> int: ------- Size of this object in bytes. """ - return TaggedTable.__sizeof__(self) + sys.getsizeof(self._time) + return Table.__sizeof__(self) + sys.getsizeof(self._time) # ------------------------------------------------------------------------------------------------------------------ # Properties diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_table_to_time_series.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_table_to_time_series.py index 73e9f602b..baa6274af 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_table_to_time_series.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_table_to_time_series.py @@ -186,7 +186,7 @@ def test_should_raise_error( ), "T", "time", - None, + ["B"], ), ], ids=["create_tagged_table", "tagged_table_not_all_columns_are_features", "tagged_table_with_feature_names_as_None"], @@ -212,3 +212,16 @@ def test_should_create_a_tagged_table( assert time_series._features == table.keep_only_columns(feature_names) assert time_series._target == table.get_column(target_name) assert time_series.time == table.get_column(time_name) + +def test_optional_parameter()->None: + table = Table( + { + "time": [0, 1], + "T": [0, 1], + }, + ) + + ts = TimeSeries._from_table_to_time_series(table=table, target_name = "T", time_name="time") + print(ts) + assert False + From a927795aac90062e59375ab0813837b556f24a43 Mon Sep 17 00:00:00 2001 From: Gerhardsa0 Date: Thu, 14 Mar 2024 23:56:36 +0100 Subject: [PATCH 02/19] TimeSeries now only child of table Fixed 82 Errors --- src/safeds/data/tabular/containers/_table.py | 2 +- .../data/tabular/containers/_time_series.py | 299 +++++++++--------- tests/helpers/_assertions.py | 5 +- .../_time_series/test_add_column.py | 2 +- .../_time_series/test_add_columns.py | 6 +- .../_time_series/test_features.py | 4 +- .../test_from_table_to_time_series.py | 47 +-- .../_tagged_table/_time_series/test_init.py | 35 +- .../_time_series/test_keep_only_columns.py | 36 +-- .../_time_series/test_remove_columns.py | 50 +-- ...test_remove_columns_with_missing_values.py | 32 -- ...emove_columns_with_non_numerical_values.py | 32 -- .../_time_series/test_slice_rows.py | 8 +- .../_time_series/test_sort_columns.py | 4 +- .../_time_series/test_time_target.py | 2 +- 15 files changed, 195 insertions(+), 369 deletions(-) diff --git a/src/safeds/data/tabular/containers/_table.py b/src/safeds/data/tabular/containers/_table.py index a189e034d..19a505ebc 100644 --- a/src/safeds/data/tabular/containers/_table.py +++ b/src/safeds/data/tabular/containers/_table.py @@ -1762,7 +1762,7 @@ def time_columns(self, target_name: str, time_name: str, feature_names: list[str """ from ._time_series import TimeSeries - return TimeSeries._from_table_to_time_series(self, target_name, time_name, feature_names) + return TimeSeries._from_table(self, target_name, time_name, feature_names) def transform_column(self, name: str, transformer: Callable[[Row], Any]) -> Table: """ diff --git a/src/safeds/data/tabular/containers/_time_series.py b/src/safeds/data/tabular/containers/_time_series.py index 989a76b60..85d2709fc 100644 --- a/src/safeds/data/tabular/containers/_time_series.py +++ b/src/safeds/data/tabular/containers/_time_series.py @@ -8,6 +8,7 @@ import pandas as pd import seaborn as sns + from safeds.data.image.containers import Image from safeds.data.tabular.containers import Column, Row, Table, TaggedTable from safeds.exceptions import ( @@ -80,7 +81,7 @@ def _from_tagged_table( return result @staticmethod - def _from_table_to_time_series( + def _from_table( table: Table, target_name: str, time_name: str, @@ -116,11 +117,13 @@ def _from_table_to_time_series( Examples -------- >>> from safeds.data.tabular.containers import Table, TimeSeries - >>> table = Table({"date": ["01.01", "01.02", "01.03", "01.04"], "f1": ["a", "b", "c", "a"], "t": [1,2,3,4]}) - >>> timeseries = TimeSeries._from_table_to_time_series(table, "t", "date", ["f1"]) + >>> test_table = Table({"date": ["01.01", "01.02", "01.03", "01.04"], "f1": ["a", "b", "c", "a"], "t": [1,2,3,4]}) + >>> timeseries = TimeSeries._from_table(test_table, "t", "date", ["f1"]) """ if feature_names is not None and time_name in feature_names: raise ValueError(f"Column '{time_name}' can not be time and feature column.") + if feature_names is not None and target_name in feature_names: + raise ValueError(f"Column '{target_name}' can not be target and feature column.") if target_name not in table.column_names: raise UnknownColumnNameError([target_name]) @@ -131,15 +134,18 @@ def _from_table_to_time_series( result._schema = table._schema result._time = table.get_column(time_name) result._target = table.get_column(target_name) - if feature_names is not None: + if feature_names is None: + result._feature_names = [] + feature_names = [] + result._features = Table() + if len(feature_names) == 0: + result._feature_names = [] + result._features = Table() + else: result._feature_names = feature_names + #for some reason it gets converted into TimeSeries sometimes + table = table._as_table() result._features = table.keep_only_columns(feature_names) - else: - result._feature_names = None - result._features = None - - - # check if time column got added as feature column return result @@ -175,8 +181,6 @@ def __init__( If columns have different lengths. ValueError If the target column is also a feature column. - ValueError - If no feature columns are specified. ValueError If time column is also a feature column UnknownColumnNameError @@ -189,12 +193,12 @@ def __init__( """ _data = Table(data) - # Validate inputs super().__init__(data) if feature_names is None: - self._feature_names = None - self._features = None + self._features = Table() + self._feature_names = [] + feature_names = [] else: self._feature_names = feature_names self._features = _data.keep_only_columns(feature_names) @@ -278,9 +282,10 @@ def add_column(self, column: Column) -> TimeSeries: ColumnSizeError If the size of the column does not match the number of rows. """ - return TimeSeries._from_tagged_table( + return TimeSeries._from_table( super().add_column(column), time_name=self.time.name, + target_name=self._target.name, ) def add_column_as_feature(self, column: Column) -> TimeSeries: @@ -306,9 +311,11 @@ def add_column_as_feature(self, column: Column) -> TimeSeries: ColumnSizeError If the size of the column does not match the number of rows. """ - return TimeSeries._from_tagged_table( - super().add_column_as_feature(column), + return TimeSeries._from_table( + super().add_column(column), + target_name=self._target.name, time_name=self.time.name, + feature_names=[*self._feature_names, column.name] ) def add_columns_as_features(self, columns: list[Column] | Table) -> TimeSeries: @@ -334,9 +341,12 @@ def add_columns_as_features(self, columns: list[Column] | Table) -> TimeSeries: ColumnSizeError If the size of any feature column does not match the number of rows. """ - return TimeSeries._from_tagged_table( - super().add_columns_as_features(columns), + return TimeSeries._from_table( + super().add_columns(columns), time_name=self.time.name, + target_name=self._target.name, + feature_names=self._feature_names + + [col.name for col in (columns.to_columns() if isinstance(columns, Table) else columns)], ) def add_columns(self, columns: list[Column] | Table) -> TimeSeries: @@ -362,9 +372,11 @@ def add_columns(self, columns: list[Column] | Table) -> TimeSeries: ColumnSizeError If at least one of the column sizes from the provided column list does not match the time series. """ - return TimeSeries._from_tagged_table( + return TimeSeries._from_table( super().add_columns(columns), time_name=self.time.name, + target_name=self._target.name, + feature_names=self._feature_names ) def add_row(self, row: Row) -> TimeSeries: @@ -388,7 +400,10 @@ def add_row(self, row: Row) -> TimeSeries: UnknownColumnNameError If the row has different column names than the time series. """ - return TimeSeries._from_tagged_table(super().add_row(row), time_name=self.time.name) + return TimeSeries._from_table(super().add_row(row), + target_name=self._target.name, + time_name=self.time.name, + feature_names=self._feature_names) def add_rows(self, rows: list[Row] | Table) -> TimeSeries: """ @@ -411,7 +426,10 @@ def add_rows(self, rows: list[Row] | Table) -> TimeSeries: UnknownColumnNameError If at least one of the rows have different column names than the time series. """ - return TimeSeries._from_tagged_table(super().add_rows(rows), time_name=self.time.name) + return TimeSeries._from_table(super().add_rows(rows), + target_name=self._target.name, + time_name=self.time.name, + feature_names=self._feature_names) def filter_rows(self, query: Callable[[Row], bool]) -> TimeSeries: """ @@ -429,9 +447,11 @@ def filter_rows(self, query: Callable[[Row], bool]) -> TimeSeries: result: TimeSeries A time series containing only the rows to match the query. """ - return TimeSeries._from_tagged_table( + return TimeSeries._from_table( super().filter_rows(query), + target_name=self._target.name, time_name=self.time.name, + feature_names=self._feature_names ) def keep_only_columns(self, column_names: list[str]) -> TimeSeries: @@ -457,22 +477,19 @@ def keep_only_columns(self, column_names: list[str]) -> TimeSeries: IllegalSchemaModificationError If none of the given columns is the target or time column or any of the feature columns. """ - if self.target.name not in column_names: + if self._target.name not in column_names: raise IllegalSchemaModificationError("Must keep the target column.") - if len(set(self.features.column_names).intersection(set(column_names))) == 0: - raise IllegalSchemaModificationError("Must keep at least one feature column.") if self.time.name not in column_names: raise IllegalSchemaModificationError("Must keep the time column.") - return TimeSeries._from_tagged_table( - TaggedTable._from_table( - super().keep_only_columns(column_names), - target_name=self.target.name, - feature_names=sorted( - set(self.features.column_names).intersection(set(column_names)), - key={val: ix for ix, val in enumerate(self.features.column_names)}.__getitem__, - ), - ), + return TimeSeries._from_table( + super().keep_only_columns(column_names), + target_name=self._target.name, time_name=self.time.name, + feature_names=sorted( + set(self._feature_names).intersection(set(column_names)), + key={val: ix for ix, val in enumerate(self._feature_names)}.__getitem__, + ), + ) def remove_columns(self, column_names: list[str]) -> TimeSeries: @@ -502,22 +519,18 @@ def remove_columns(self, column_names: list[str]) -> TimeSeries: IllegalSchemaModificationError If the given columns contain all the feature columns. """ - if self.target.name in column_names: - raise ColumnIsTargetError(self.target.name) - if len(set(self.features.column_names) - set(column_names)) == 0: - raise IllegalSchemaModificationError("You cannot remove every feature column.") + if self._target.name in column_names: + raise ColumnIsTargetError(self._target.name) if self.time.name in column_names: raise ColumnIsTimeError(self.time.name) - return TimeSeries._from_tagged_table( - TaggedTable._from_table( - super().remove_columns(column_names), - target_name=self.target.name, - feature_names=sorted( - set(self.features.column_names) - set(column_names), - key={val: ix for ix, val in enumerate(self.features.column_names)}.__getitem__, - ), - ), + return TimeSeries._from_table( + super().remove_columns(column_names), + target_name=self._target.name, time_name=self.time.name, + feature_names=sorted( + set(self._feature_names) - set(column_names), + key={val: ix for ix, val in enumerate(self._feature_names)}.__getitem__, + ), ) def remove_columns_with_missing_values(self) -> TimeSeries: @@ -541,18 +554,19 @@ def remove_columns_with_missing_values(self) -> TimeSeries: If the columns to remove contain all the feature columns. """ table = super().remove_columns_with_missing_values() + if self._target.name not in table.column_names: + raise ColumnIsTargetError(self._target.name) if self.time.name not in table.column_names: raise ColumnIsTimeError(self.time.name) - return TimeSeries._from_tagged_table( - TaggedTable._from_table( - table, - self.target.name, - feature_names=sorted( - set(self.features.column_names).intersection(set(table.column_names)), - key={val: ix for ix, val in enumerate(self.features.column_names)}.__getitem__, - ), + print("!!!!") + return TimeSeries._from_table( + table, + target_name=self._target.name, + time_name=self._time.name, + feature_names=sorted( + set(self._feature_names).intersection(set(table.column_names)), + key={val: ix for ix, val in enumerate(self._feature_names)}.__getitem__, ), - time_name=self.time.name, ) def remove_columns_with_non_numerical_values(self) -> TimeSeries: @@ -576,18 +590,18 @@ def remove_columns_with_non_numerical_values(self) -> TimeSeries: If the columns to remove contain all the feature columns. """ table = super().remove_columns_with_non_numerical_values() + if self._target.name not in table.column_names: + raise ColumnIsTargetError(self._target.name) if self.time.name not in table.column_names: raise ColumnIsTimeError(self.time.name) - return TimeSeries._from_tagged_table( - TaggedTable._from_table( - table, - self.target.name, - feature_names=sorted( - set(self.features.column_names).intersection(set(table.column_names)), - key={val: ix for ix, val in enumerate(self.features.column_names)}.__getitem__, - ), - ), + return TimeSeries._from_table( + table, + self._target.name, time_name=self.time.name, + feature_names=sorted( + set(self._feature_names).intersection(set(table.column_names)), + key={val: ix for ix, val in enumerate(self._feature_names)}.__getitem__, + ), ) def remove_duplicate_rows(self) -> TimeSeries: @@ -601,12 +615,10 @@ def remove_duplicate_rows(self) -> TimeSeries: result : TimeSeries The time series with the duplicate rows removed. """ - return TimeSeries._from_tagged_table( - TaggedTable._from_table( - super().remove_duplicate_rows(), - target_name=self.target.name, - feature_names=self.features.column_names, - ), + return TimeSeries._from_table( + super().remove_duplicate_rows(), + target_name=self._target.name, + feature_names=self._feature_names, time_name=self.time.name, ) @@ -621,13 +633,11 @@ def remove_rows_with_missing_values(self) -> TimeSeries: table : TimeSeries A time series without the rows that contain missing values. """ - return TimeSeries._from_tagged_table( - TaggedTable._from_table( - super().remove_rows_with_missing_values(), - target_name=self.target.name, - feature_names=self.features.column_names, - ), + return TimeSeries._from_table( + super().remove_rows_with_missing_values(), time_name=self.time.name, + target_name=self._target.name, + feature_names=self._feature_names, ) def remove_rows_with_outliers(self) -> TimeSeries: @@ -645,13 +655,11 @@ def remove_rows_with_outliers(self) -> TimeSeries: new_time_series : TimeSeries A new time series without rows containing outliers. """ - return TimeSeries._from_tagged_table( - TaggedTable._from_table( - super().remove_rows_with_outliers(), - target_name=self.target.name, - feature_names=self.features.column_names, - ), + return TimeSeries._from_table( + super().remove_rows_with_outliers(), time_name=self.time.name, + target_name=self._target.name, + feature_names=self._feature_names, ) def rename_column(self, old_name: str, new_name: str) -> TimeSeries: @@ -679,20 +687,18 @@ def rename_column(self, old_name: str, new_name: str) -> TimeSeries: DuplicateColumnNameError If the specified new target column name already exists. """ - return TimeSeries._from_tagged_table( - TaggedTable._from_table( - super().rename_column(old_name, new_name), - target_name=new_name if self.target.name == old_name else self.target.name, - feature_names=( - self.features.column_names - if old_name not in self.features.column_names - else [ - column_name if column_name != old_name else new_name - for column_name in self.features.column_names - ] - ), - ), + return TimeSeries._from_table( + super().rename_column(old_name, new_name), time_name=new_name if self.time.name == old_name else self.time.name, + target_name=new_name if self._target.name == old_name else self._target.name, + feature_names=( + self._feature_names + if old_name not in self._feature_names + else [ + column_name if column_name != old_name else new_name + for column_name in self._feature_names + ] + ) ) def replace_column(self, old_column_name: str, new_columns: list[Column]) -> TimeSeries: @@ -734,42 +740,37 @@ def replace_column(self, old_column_name: str, new_columns: list[Column]) -> Tim f'Time column "{self.time.name}" can only be replaced by exactly one new column.', ) else: - return TimeSeries._from_tagged_table( - TaggedTable._from_table( - super().replace_column(old_column_name, new_columns), - target_name=self.target.name, - feature_names=self.features.column_names, - ), - time_name=new_columns[0].name, + return TimeSeries._from_table( + super().replace_column(old_column_name, new_columns), + target_name=self._target.name, + feature_names=self._feature_names, + time_name=new_columns[0].name ) - if old_column_name == self.target.name: + if old_column_name == self._target.name: if len(new_columns) != 1: raise IllegalSchemaModificationError( - f'Target column "{self.target.name}" can only be replaced by exactly one new column.', + f'Target column "{self._target.name}" can only be replaced by exactly one new column.', ) else: - return TimeSeries._from_tagged_table( - TaggedTable._from_table( - super().replace_column(old_column_name, new_columns), - target_name=new_columns[0].name, - feature_names=self.features.column_names, - ), + return TimeSeries._from_table( + super().replace_column(old_column_name, new_columns), + target_name=new_columns[0].name, time_name=self.time.name, + feature_names=self._feature_names, ) + else: - return TimeSeries._from_tagged_table( - TaggedTable._from_table( - super().replace_column(old_column_name, new_columns), - target_name=self.target.name, - feature_names=( - self.features.column_names - if old_column_name not in self.features.column_names - else self.features.column_names[: self.features.column_names.index(old_column_name)] - + [col.name for col in new_columns] - + self.features.column_names[self.features.column_names.index(old_column_name) + 1 :] - ), - ), + return TimeSeries._from_table( + super().replace_column(old_column_name, new_columns), + target_name=self._target.name, time_name=self.time.name, + feature_names=( + self._feature_names + if old_column_name not in self._feature_names + else self._feature_names[: self._feature_names.index(old_column_name)] + + [col.name for col in new_columns] + + self._feature_names[self._feature_names.index(old_column_name) + 1:] + ), ) def slice_rows( @@ -802,19 +803,17 @@ def slice_rows( IndexOutOfBoundsError If the index is out of bounds. """ - return TimeSeries._from_tagged_table( - TaggedTable._from_table( - super().slice_rows(start, end, step), - target_name=self.target.name, - feature_names=self.features.column_names, - ), - time_name=self.time.name, + return TimeSeries._from_table( + super().slice_rows(start, end, step), + target_name=self._target.name, + feature_names=self._feature_names, + time_name=self.time.name ) def sort_columns( self, comparator: Callable[[Column, Column], int] = lambda col1, col2: (col1.name > col2.name) - - (col1.name < col2.name), + - (col1.name < col2.name), ) -> TimeSeries: """ Sort the columns of a `TimeSeries` with the given comparator and return a new `TimeSeries`. @@ -841,16 +840,14 @@ def sort_columns( A new time series with sorted columns. """ sorted_table = super().sort_columns(comparator) - return TimeSeries._from_tagged_table( - TaggedTable._from_table( - sorted_table, - target_name=self.target.name, - feature_names=sorted( - set(sorted_table.column_names).intersection(self.features.column_names), - key={val: ix for ix, val in enumerate(sorted_table.column_names)}.__getitem__, - ), - ), + return TimeSeries._from_table( + sorted_table, time_name=self.time.name, + target_name=self._target.name, + feature_names=sorted( + set(sorted_table.column_names).intersection(self._feature_names), + key={val: ix for ix, val in enumerate(sorted_table.column_names)}.__getitem__, + ), ) def transform_column(self, name: str, transformer: Callable[[Row], Any]) -> TimeSeries: @@ -876,13 +873,11 @@ def transform_column(self, name: str, transformer: Callable[[Row], Any]) -> Time UnknownColumnNameError If the column does not exist. """ - return TimeSeries._from_tagged_table( - TaggedTable._from_table( - super().transform_column(name, transformer), - target_name=self.target.name, - feature_names=self.features.column_names, - ), + return TimeSeries._from_table( + super().transform_column(name, transformer), time_name=self.time.name, + target_name=self._target.name, + feature_names=self._feature_names, ) def plot_lagplot(self, lag: int) -> Image: @@ -911,9 +906,9 @@ def plot_lagplot(self, lag: int) -> Image: >>> image = table.plot_lagplot(lag = 1) """ - if not self.target.type.is_numeric(): + if not self._target.type.is_numeric(): raise NonNumericColumnError("This time series target contains non-numerical columns.") - ax = pd.plotting.lag_plot(self.target._data, lag=lag) + ax = pd.plotting.lag_plot(self._target._data, lag=lag) fig = ax.figure buffer = io.BytesIO() fig.savefig(buffer, format="png") @@ -961,7 +956,7 @@ def plot_lineplot(self, x_column_name: str | None = None, y_column_name: str | N raise NonNumericColumnError("The time series plotted column contains non-numerical columns.") if y_column_name is None: - y_column_name = self.target.name + y_column_name = self._target.name elif y_column_name not in self._data.columns: raise UnknownColumnNameError([y_column_name]) @@ -1037,7 +1032,7 @@ def plot_scatterplot( raise NonNumericColumnError("The time series plotted column contains non-numerical columns.") if y_column_name is None: - y_column_name = self.target.name + y_column_name = self._target.name elif y_column_name not in self._data.columns: raise UnknownColumnNameError([y_column_name]) if x_column_name is None: diff --git a/tests/helpers/_assertions.py b/tests/helpers/_assertions.py index 308db5b4f..952a808cb 100644 --- a/tests/helpers/_assertions.py +++ b/tests/helpers/_assertions.py @@ -53,7 +53,8 @@ def assert_that_time_series_are_equal(table1: TimeSeries, table2: TimeSeries) -> The timeseries to compare the first timeseries to. """ assert table1.schema == table2.schema - assert table1.features == table2.features - assert table1.target == table2.target + assert table1._feature_names == table2._feature_names + assert table1._features == table2._features + assert table1._target == table2._target assert table1.time == table2.time assert table1 == table2 diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_column.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_column.py index 431fc1283..8cb4eb7ac 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_column.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_column.py @@ -28,7 +28,7 @@ }, target_name="target", time_name="time", - feature_names=["feature_1"], + feature_names=None, ), ), ], diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_columns.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_columns.py index ca86cc122..ffe2bf6c6 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_columns.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_columns.py @@ -29,7 +29,7 @@ }, "target", "time", - ["feature_1"], + None, ), ), ], @@ -40,4 +40,8 @@ def test_should_add_columns( columns: list[Column], expected_time_series: TimeSeries, ) -> None: + print(len(time_series.add_columns(columns)._feature_names)) + print(expected_time_series._feature_names) + print(time_series.add_columns(columns)._features) + print(expected_time_series._features) assert_that_time_series_are_equal(time_series.add_columns(columns), expected_time_series) diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py index aa9631fc5..d0feb108c 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py @@ -16,6 +16,7 @@ }, target_name="T", time_name="time", + feature_names=["A", "B", "C"] ), Table({"A": [1, 4], "B": [2, 5], "C": [3, 6]}), ), @@ -38,4 +39,5 @@ ids=["only_target_and_features", "target_features_and_other"], ) def test_should_return_features(time_series: TimeSeries, features: Table) -> None: - assert time_series.features == features + print(time_series._features) + assert time_series._features == features diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_table_to_time_series.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_table_to_time_series.py index baa6274af..095626f4f 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_table_to_time_series.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_table_to_time_series.py @@ -52,36 +52,7 @@ "time", ["A", "B", "C"], ValueError, - r"Column 'A' cannot be both feature and target.", - ), - ( - Table( - { - "time": [0, 1], - "A": [1, 4], - "B": [2, 5], - "C": [3, 6], - "T": [0, 1], - }, - ), - "A", - "time", - [], - ValueError, - r"At least one feature column must be specified.", - ), - ( - Table( - { - "time": [0, 1], - "A": [1, 4], - }, - ), - "A", - "time", - None, - ValueError, - r"At least one feature column must be specified.", + r"Column 'A' can not be target and feature column.", ), ( Table( @@ -120,8 +91,6 @@ "feature_does_not_exist", "target_does_not_exist", "target_and_feature_overlap", - "features_are_empty-explicitly", - "features_are_empty_implicitly", "time_does_not_exist", "time_is_also_feature", ], @@ -135,7 +104,7 @@ def test_should_raise_error( error_msg: str, ) -> None: with pytest.raises(error, match=error_msg): - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( table, target_name=target_name, time_name=time_name, @@ -197,7 +166,7 @@ def test_should_create_a_tagged_table( time_name: str, feature_names: list[str] | None, ) -> None: - time_series = TimeSeries._from_table_to_time_series( + time_series = TimeSeries._from_table( table, target_name=target_name, time_name=time_name, @@ -213,15 +182,5 @@ def test_should_create_a_tagged_table( assert time_series._target == table.get_column(target_name) assert time_series.time == table.get_column(time_name) -def test_optional_parameter()->None: - table = Table( - { - "time": [0, 1], - "T": [0, 1], - }, - ) - ts = TimeSeries._from_table_to_time_series(table=table, target_name = "T", time_name="time") - print(ts) - assert False diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_init.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_init.py index 8c7619fcc..ee79a12c0 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_init.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_init.py @@ -46,32 +46,7 @@ "A", ["A", "B", "C"], ValueError, - r"Column 'A' cannot be both feature and target.", - ), - ( - { - "time": [0, 1], - "A": [1, 4], - "B": [2, 5], - "C": [3, 6], - "T": [0, 1], - }, - "time", - "D", - [], - ValueError, - r"At least one feature column must be specified.", - ), - ( - { - "time": [0, 1], - "A": [1, 4], - }, - "time", - "A", - None, - ValueError, - r"At least one feature column must be specified.", + r"Column 'A' can not be time and feature column.", ), ( { @@ -106,8 +81,6 @@ "feature_does_not_exist", "target_does_not_exist", "target_and_feature_overlap", - "features_are_empty-explicitly", - "features_are_empty_implicitly", "time_column_does_not_exist", "time_is_also_feature", ], @@ -174,11 +147,9 @@ def test_should_create_a_time_series( ) -> None: time_series = TimeSeries(data, target_name=target_name, time_name=time_name, feature_names=feature_names) if feature_names is None: - feature_names = list(data.keys()) - feature_names.remove(target_name) - feature_names.remove(time_name) + feature_names = [] assert isinstance(time_series, TimeSeries) - assert time_series._features.column_names == feature_names + assert time_series._feature_names == feature_names assert time_series._target.name == target_name assert time_series._features == Table(data).keep_only_columns(feature_names) assert time_series._target == Table(data).get_column(target_name) diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_keep_only_columns.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_keep_only_columns.py index 190c387d1..c6a7ac051 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_keep_only_columns.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_keep_only_columns.py @@ -9,7 +9,7 @@ ("table", "column_names", "expected"), [ ( - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table( { "time": [0, 1, 2], @@ -22,7 +22,7 @@ "time", ), ["feat1", "target", "time"], - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table( { "time": [0, 1, 2], @@ -35,7 +35,7 @@ ), ), ( - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table( { "time": [0, 1, 2], @@ -49,7 +49,7 @@ "time", ), ["feat1", "other", "target", "time"], - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table( { "time": [0, 1, 2], @@ -63,7 +63,7 @@ ), ), ( - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table( { "time": [0, 1, 2], @@ -77,7 +77,7 @@ "time", ), ["feat1", "target", "time"], - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table( { "time": [0, 1, 2], @@ -101,7 +101,7 @@ def test_should_return_table(table: TimeSeries, column_names: list[str], expecte ("table", "column_names", "error_msg"), [ ( - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table( { "time": [0, 1, 2], @@ -119,25 +119,7 @@ def test_should_return_table(table: TimeSeries, column_names: list[str], expecte r"Illegal schema modification: Must keep the target column.", ), ( - TimeSeries._from_table_to_time_series( - Table( - { - "time": [0, 1, 2], - "feat1": [1, 2, 3], - "feat2": [4, 5, 6], - "other": [3, 5, 7], - "target": [7, 8, 9], - }, - ), - "target", - "time", - ["feat1", "feat2"], - ), - ["target", "other"], - r"Illegal schema modification: Must keep at least one feature column.", - ), - ( - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table( { "time": [0, 1, 2], @@ -155,7 +137,7 @@ def test_should_return_table(table: TimeSeries, column_names: list[str], expecte r"Illegal schema modification: Must keep the time column.", ), ], - ids=["table_remove_target", "table_remove_all_features", "table_remove_time"], + ids=["table_remove_target", "table_remove_time"], ) def test_should_raise_illegal_schema_modification(table: TimeSeries, column_names: list[str], error_msg: str) -> None: with pytest.raises( diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns.py index ccadbd877..9c175abc7 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns.py @@ -9,7 +9,7 @@ ("table", "columns", "expected"), [ ( - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table( { "time": [0, 1, 2], @@ -25,7 +25,7 @@ ["feat_1", "feat_2"], ), ["feat_2"], - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table({ "time": [0, 1, 2], "feat_1": [1, 2, 3], @@ -39,7 +39,7 @@ ), ), ( - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table( { "time": [0, 1, 2], @@ -55,7 +55,7 @@ ["feat_1", "feat_2"], ), ["non_feat_2"], - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table({ "time": [0, 1, 2], "feat_1": [1, 2, 3], @@ -69,7 +69,7 @@ ), ), ( - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table( { "time": [0, 1, 2], @@ -85,7 +85,7 @@ ["feat_1", "feat_2"], ), ["non_feat_1", "non_feat_2"], - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table({"time": [0, 1, 2], "feat_1": [1, 2, 3], "feat_2": [4, 5, 6], "target": [7, 8, 9]}), "target", "time", @@ -93,7 +93,7 @@ ), ), ( - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table( { "time": [0, 1, 2], @@ -109,7 +109,7 @@ ["feat_1", "feat_2"], ), ["feat_2", "non_feat_2"], - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table({"time": [0, 1, 2], "feat_1": [1, 2, 3], "non_feat_1": [2, 4, 6], "target": [7, 8, 9]}), "target", "time", @@ -117,7 +117,7 @@ ), ), ( - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table( { "time": [0, 1, 2], @@ -131,7 +131,7 @@ ["feat_1"], ), [], - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table({"time": [0, 1, 2], "feat_1": [1, 2, 3], "non_feat_1": [2, 4, 6], "target": [7, 8, 9]}), "target", "time", @@ -156,7 +156,7 @@ def test_should_remove_columns(table: TimeSeries, columns: list[str], expected: ("table", "columns", "error", "error_msg"), [ ( - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table({"time": [0, 1, 2], "feat": [1, 2, 3], "non_feat": [1, 2, 3], "target": [4, 5, 6]}), "target", "time", @@ -167,7 +167,7 @@ def test_should_remove_columns(table: TimeSeries, columns: list[str], expected: r'Illegal schema modification: Column "target" is the target column and cannot be removed.', ), ( - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table({"time": [0, 1, 2], "feat": [1, 2, 3], "non_feat": [1, 2, 3], "target": [4, 5, 6]}), "target", "time", @@ -178,29 +178,7 @@ def test_should_remove_columns(table: TimeSeries, columns: list[str], expected: r'Illegal schema modification: Column "target" is the target column and cannot be removed.', ), ( - TimeSeries._from_table_to_time_series( - Table({"time": [0, 1, 2], "feat": [1, 2, 3], "non_feat": [1, 2, 3], "target": [4, 5, 6]}), - "target", - "time", - ["feat"], - ), - ["feat"], - IllegalSchemaModificationError, - r"Illegal schema modification: You cannot remove every feature column.", - ), - ( - TimeSeries._from_table_to_time_series( - Table({"time": [0, 1, 2], "feat": [1, 2, 3], "non_feat": [1, 2, 3], "target": [4, 5, 6]}), - "target", - "time", - ["feat"], - ), - ["feat", "non_feat"], - IllegalSchemaModificationError, - r"Illegal schema modification: You cannot remove every feature column.", - ), - ( - TimeSeries._from_table_to_time_series( + TimeSeries._from_table( Table({"time": [0, 1, 2], "feat": [1, 2, 3], "non_feat": [1, 2, 3], "target": [4, 5, 6]}), "target", "time", @@ -214,8 +192,6 @@ def test_should_remove_columns(table: TimeSeries, columns: list[str], expected: ids=[ "remove_only_target", "remove_non_feat_and_target", - "remove_all_features", - "remove_non_feat_and_all_features", "remove_time_column", ], ) diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_missing_values.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_missing_values.py index 01958f2dc..73e82214b 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_missing_values.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_missing_values.py @@ -168,36 +168,6 @@ def test_should_remove_columns_with_non_numerical_values(table: TimeSeries, expe ColumnIsTargetError, 'Illegal schema modification: Column "target" is the target column and cannot be removed.', ), - ( - TimeSeries( - { - "time": [0, 1, 2], - "feature": [0, None, 2], - "non_feature": [1, 2, 3], - "target": [3, 2, 5], - }, - "target", - "time", - ["feature"], - ), - IllegalSchemaModificationError, - "Illegal schema modification: You cannot remove every feature column.", - ), - ( - TimeSeries( - { - "time": [0, 1, 2], - "feature": [0, None, 2], - "non_feature": [1, None, 3], - "target": [3, 2, 5], - }, - "target", - "time", - ["feature"], - ), - IllegalSchemaModificationError, - "Illegal schema modification: You cannot remove every feature column.", - ), ], ids=[ "only_target_incomplete", @@ -205,8 +175,6 @@ def test_should_remove_columns_with_non_numerical_values(table: TimeSeries, expe "time_is_incomplete", "also_non_feature_incomplete", "all_incomplete", - "all_features_incomplete", - "all_features_and_non_feature_incomplete", ], ) def test_should_raise_in_remove_columns_with_missing_values( diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_non_numerical_values.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_non_numerical_values.py index d735edb51..3ba5d7f37 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_non_numerical_values.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_non_numerical_values.py @@ -168,36 +168,6 @@ def test_should_remove_columns_with_non_numerical_values(table: TimeSeries, expe ColumnIsTargetError, r'Illegal schema modification: Column "target" is the target column and cannot be removed.', ), - ( - TimeSeries( - { - "time": [0, 1, 2], - "feature": [0, "a", 2], - "non_feature": [1, 2, 3], - "target": [3, 2, 5], - }, - "target", - "time", - ["feature"], - ), - IllegalSchemaModificationError, - r"Illegal schema modification: You cannot remove every feature column.", - ), - ( - TimeSeries( - { - "time": [0, 1, 2], - "feature": [0, "a", 2], - "non_feature": [1, "b", 3], - "target": [3, 2, 5], - }, - "target", - "time", - ["feature"], - ), - IllegalSchemaModificationError, - r"Illegal schema modification: You cannot remove every feature column.", - ), ], ids=[ "only_target_non_numerical", @@ -205,8 +175,6 @@ def test_should_remove_columns_with_non_numerical_values(table: TimeSeries, expe "also_non_feature_non_numerical", "time_non_numerical", "all_non_numerical", - "all_features_non_numerical", - "all_features_and_non_feature_non_numerical", ], ) def test_should_raise_in_remove_columns_with_non_numerical_values( diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_slice_rows.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_slice_rows.py index 1625ba17c..e8788e52d 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_slice_rows.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_slice_rows.py @@ -3,7 +3,7 @@ from safeds.data.tabular.containers import TimeSeries from safeds.exceptions import IndexOutOfBoundsError -from tests.helpers import assert_that_tagged_tables_are_equal +from tests.helpers import assert_that_time_series_are_equal @pytest.mark.parametrize( @@ -36,9 +36,9 @@ def test_should_slice_rows(table: TimeSeries, test_table: TimeSeries, second_tes new_table = table.slice_rows(0, 2, 1) second_new_table = table.slice_rows(0, 3, 2) third_new_table = table.slice_rows() - assert_that_tagged_tables_are_equal(new_table, test_table) - assert_that_tagged_tables_are_equal(second_new_table, second_test_table) - assert_that_tagged_tables_are_equal(third_new_table, table) + assert_that_time_series_are_equal(new_table, test_table) + assert_that_time_series_are_equal(second_new_table, second_test_table) + assert_that_time_series_are_equal(third_new_table, table) @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_sort_columns.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_sort_columns.py index c50bb9f78..679816069 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_sort_columns.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_sort_columns.py @@ -57,6 +57,6 @@ def test_should_return_sorted_table( assert table_sorted_columns[2] == columns[col3] assert table_sorted_columns[3] == columns[col4] assert table_sorted_columns[4] == columns[col5] - assert table_sorted.features == table1.features - assert table_sorted.target == table1.target + assert table_sorted._features == table1._features + assert table_sorted._target == table1._target assert table_sorted.time == table1.time diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_time_target.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_time_target.py index 31dc2b899..e7ccba76a 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_time_target.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_time_target.py @@ -26,5 +26,5 @@ ids=["target"], ) def test_should_return_target(time_series: TimeSeries, target_column: Column, time_column: Column) -> None: - assert time_series.target == target_column + assert time_series._target == target_column assert time_series.time == time_column From 83d2b7e7db035d5c4e79191c31e868ac82febf4b Mon Sep 17 00:00:00 2001 From: Gerhardsa0 Date: Fri, 15 Mar 2024 14:25:29 +0100 Subject: [PATCH 03/19] linter fixes --- src/safeds/data/tabular/containers/_time_series.py | 1 - .../_table/_tagged_table/_time_series/test_add_columns.py | 4 ---- .../_table/_tagged_table/_time_series/test_features.py | 1 - 3 files changed, 6 deletions(-) diff --git a/src/safeds/data/tabular/containers/_time_series.py b/src/safeds/data/tabular/containers/_time_series.py index 85d2709fc..434d4374f 100644 --- a/src/safeds/data/tabular/containers/_time_series.py +++ b/src/safeds/data/tabular/containers/_time_series.py @@ -558,7 +558,6 @@ def remove_columns_with_missing_values(self) -> TimeSeries: raise ColumnIsTargetError(self._target.name) if self.time.name not in table.column_names: raise ColumnIsTimeError(self.time.name) - print("!!!!") return TimeSeries._from_table( table, target_name=self._target.name, diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_columns.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_columns.py index ffe2bf6c6..3433e4d28 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_columns.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_columns.py @@ -40,8 +40,4 @@ def test_should_add_columns( columns: list[Column], expected_time_series: TimeSeries, ) -> None: - print(len(time_series.add_columns(columns)._feature_names)) - print(expected_time_series._feature_names) - print(time_series.add_columns(columns)._features) - print(expected_time_series._features) assert_that_time_series_are_equal(time_series.add_columns(columns), expected_time_series) diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py index d0feb108c..2d97fc05d 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py @@ -39,5 +39,4 @@ ids=["only_target_and_features", "target_features_and_other"], ) def test_should_return_features(time_series: TimeSeries, features: Table) -> None: - print(time_series._features) assert time_series._features == features From 4ef1fbf3ed0d3ca43411f249ccd3b5a969307b8a Mon Sep 17 00:00:00 2001 From: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com> Date: Fri, 15 Mar 2024 13:27:08 +0000 Subject: [PATCH 04/19] style: apply automated linter fixes --- src/safeds/data/tabular/containers/_table.py | 2 +- .../data/tabular/containers/_time_series.py | 49 +++++++++---------- .../_time_series/test_features.py | 2 +- .../test_from_table_to_time_series.py | 3 -- .../_time_series/test_remove_columns.py | 2 +- ...test_remove_columns_with_missing_values.py | 2 +- ...emove_columns_with_non_numerical_values.py | 2 +- 7 files changed, 29 insertions(+), 33 deletions(-) diff --git a/src/safeds/data/tabular/containers/_table.py b/src/safeds/data/tabular/containers/_table.py index 19a505ebc..7f9699909 100644 --- a/src/safeds/data/tabular/containers/_table.py +++ b/src/safeds/data/tabular/containers/_table.py @@ -1,8 +1,8 @@ from __future__ import annotations -import sys import functools import io +import sys import warnings from pathlib import Path from typing import TYPE_CHECKING, Any, TypeVar diff --git a/src/safeds/data/tabular/containers/_time_series.py b/src/safeds/data/tabular/containers/_time_series.py index 434d4374f..1d69ebade 100644 --- a/src/safeds/data/tabular/containers/_time_series.py +++ b/src/safeds/data/tabular/containers/_time_series.py @@ -8,7 +8,6 @@ import pandas as pd import seaborn as sns - from safeds.data.image.containers import Image from safeds.data.tabular.containers import Column, Row, Table, TaggedTable from safeds.exceptions import ( @@ -143,7 +142,7 @@ def _from_table( result._features = Table() else: result._feature_names = feature_names - #for some reason it gets converted into TimeSeries sometimes + # for some reason it gets converted into TimeSeries sometimes table = table._as_table() result._features = table.keep_only_columns(feature_names) @@ -315,7 +314,7 @@ def add_column_as_feature(self, column: Column) -> TimeSeries: super().add_column(column), target_name=self._target.name, time_name=self.time.name, - feature_names=[*self._feature_names, column.name] + feature_names=[*self._feature_names, column.name], ) def add_columns_as_features(self, columns: list[Column] | Table) -> TimeSeries: @@ -346,7 +345,7 @@ def add_columns_as_features(self, columns: list[Column] | Table) -> TimeSeries: time_name=self.time.name, target_name=self._target.name, feature_names=self._feature_names - + [col.name for col in (columns.to_columns() if isinstance(columns, Table) else columns)], + + [col.name for col in (columns.to_columns() if isinstance(columns, Table) else columns)], ) def add_columns(self, columns: list[Column] | Table) -> TimeSeries: @@ -376,7 +375,7 @@ def add_columns(self, columns: list[Column] | Table) -> TimeSeries: super().add_columns(columns), time_name=self.time.name, target_name=self._target.name, - feature_names=self._feature_names + feature_names=self._feature_names, ) def add_row(self, row: Row) -> TimeSeries: @@ -400,10 +399,12 @@ def add_row(self, row: Row) -> TimeSeries: UnknownColumnNameError If the row has different column names than the time series. """ - return TimeSeries._from_table(super().add_row(row), - target_name=self._target.name, - time_name=self.time.name, - feature_names=self._feature_names) + return TimeSeries._from_table( + super().add_row(row), + target_name=self._target.name, + time_name=self.time.name, + feature_names=self._feature_names, + ) def add_rows(self, rows: list[Row] | Table) -> TimeSeries: """ @@ -426,10 +427,12 @@ def add_rows(self, rows: list[Row] | Table) -> TimeSeries: UnknownColumnNameError If at least one of the rows have different column names than the time series. """ - return TimeSeries._from_table(super().add_rows(rows), - target_name=self._target.name, - time_name=self.time.name, - feature_names=self._feature_names) + return TimeSeries._from_table( + super().add_rows(rows), + target_name=self._target.name, + time_name=self.time.name, + feature_names=self._feature_names, + ) def filter_rows(self, query: Callable[[Row], bool]) -> TimeSeries: """ @@ -451,7 +454,7 @@ def filter_rows(self, query: Callable[[Row], bool]) -> TimeSeries: super().filter_rows(query), target_name=self._target.name, time_name=self.time.name, - feature_names=self._feature_names + feature_names=self._feature_names, ) def keep_only_columns(self, column_names: list[str]) -> TimeSeries: @@ -489,7 +492,6 @@ def keep_only_columns(self, column_names: list[str]) -> TimeSeries: set(self._feature_names).intersection(set(column_names)), key={val: ix for ix, val in enumerate(self._feature_names)}.__getitem__, ), - ) def remove_columns(self, column_names: list[str]) -> TimeSeries: @@ -693,11 +695,8 @@ def rename_column(self, old_name: str, new_name: str) -> TimeSeries: feature_names=( self._feature_names if old_name not in self._feature_names - else [ - column_name if column_name != old_name else new_name - for column_name in self._feature_names - ] - ) + else [column_name if column_name != old_name else new_name for column_name in self._feature_names] + ), ) def replace_column(self, old_column_name: str, new_columns: list[Column]) -> TimeSeries: @@ -743,7 +742,7 @@ def replace_column(self, old_column_name: str, new_columns: list[Column]) -> Tim super().replace_column(old_column_name, new_columns), target_name=self._target.name, feature_names=self._feature_names, - time_name=new_columns[0].name + time_name=new_columns[0].name, ) if old_column_name == self._target.name: if len(new_columns) != 1: @@ -767,8 +766,8 @@ def replace_column(self, old_column_name: str, new_columns: list[Column]) -> Tim self._feature_names if old_column_name not in self._feature_names else self._feature_names[: self._feature_names.index(old_column_name)] - + [col.name for col in new_columns] - + self._feature_names[self._feature_names.index(old_column_name) + 1:] + + [col.name for col in new_columns] + + self._feature_names[self._feature_names.index(old_column_name) + 1 :] ), ) @@ -806,13 +805,13 @@ def slice_rows( super().slice_rows(start, end, step), target_name=self._target.name, feature_names=self._feature_names, - time_name=self.time.name + time_name=self.time.name, ) def sort_columns( self, comparator: Callable[[Column, Column], int] = lambda col1, col2: (col1.name > col2.name) - - (col1.name < col2.name), + - (col1.name < col2.name), ) -> TimeSeries: """ Sort the columns of a `TimeSeries` with the given comparator and return a new `TimeSeries`. diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py index 2d97fc05d..8297956d2 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py @@ -16,7 +16,7 @@ }, target_name="T", time_name="time", - feature_names=["A", "B", "C"] + feature_names=["A", "B", "C"], ), Table({"A": [1, 4], "B": [2, 5], "C": [3, 6]}), ), diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_table_to_time_series.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_table_to_time_series.py index 095626f4f..559cf0b0f 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_table_to_time_series.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_table_to_time_series.py @@ -181,6 +181,3 @@ def test_should_create_a_tagged_table( assert time_series._features == table.keep_only_columns(feature_names) assert time_series._target == table.get_column(target_name) assert time_series.time == table.get_column(time_name) - - - diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns.py index 9c175abc7..5a51e70e1 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import Table, TimeSeries -from safeds.exceptions import ColumnIsTargetError, ColumnIsTimeError, IllegalSchemaModificationError +from safeds.exceptions import ColumnIsTargetError, ColumnIsTimeError from tests.helpers import assert_that_time_series_are_equal diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_missing_values.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_missing_values.py index 73e82214b..319e27c5f 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_missing_values.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_missing_values.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import TimeSeries -from safeds.exceptions import ColumnIsTargetError, ColumnIsTimeError, IllegalSchemaModificationError +from safeds.exceptions import ColumnIsTargetError, ColumnIsTimeError from tests.helpers import assert_that_time_series_are_equal diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_non_numerical_values.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_non_numerical_values.py index 3ba5d7f37..03d6e8572 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_non_numerical_values.py +++ b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_non_numerical_values.py @@ -1,6 +1,6 @@ import pytest from safeds.data.tabular.containers import TimeSeries -from safeds.exceptions import ColumnIsTargetError, ColumnIsTimeError, IllegalSchemaModificationError +from safeds.exceptions import ColumnIsTargetError, ColumnIsTimeError from tests.helpers import assert_that_time_series_are_equal From 4da1052245fc44b7ef6c75d01f14102ee5351f35 Mon Sep 17 00:00:00 2001 From: Gerhardsa0 Date: Fri, 15 Mar 2024 14:51:03 +0100 Subject: [PATCH 05/19] added propertys --- .../data/tabular/containers/_time_series.py | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/safeds/data/tabular/containers/_time_series.py b/src/safeds/data/tabular/containers/_time_series.py index 1d69ebade..a3be44c49 100644 --- a/src/safeds/data/tabular/containers/_time_series.py +++ b/src/safeds/data/tabular/containers/_time_series.py @@ -224,6 +224,29 @@ def __sizeof__(self) -> int: # Properties # ------------------------------------------------------------------------------------------------------------------ + @property + def target(self) -> Column: + """ + Get the target column of the tagged table. + + Returns + ------- + Column + The target column. + """ + return self._target + + @property + def features(self) -> Table: + """ + Get the feature columns of the tagged table. + + Returns + ------- + Table + The table containing the feature columns. + """ + return self._features @property def time(self) -> Column: """ @@ -345,7 +368,7 @@ def add_columns_as_features(self, columns: list[Column] | Table) -> TimeSeries: time_name=self.time.name, target_name=self._target.name, feature_names=self._feature_names - + [col.name for col in (columns.to_columns() if isinstance(columns, Table) else columns)], + + [col.name for col in (columns.to_columns() if isinstance(columns, Table) else columns)], ) def add_columns(self, columns: list[Column] | Table) -> TimeSeries: @@ -766,8 +789,8 @@ def replace_column(self, old_column_name: str, new_columns: list[Column]) -> Tim self._feature_names if old_column_name not in self._feature_names else self._feature_names[: self._feature_names.index(old_column_name)] - + [col.name for col in new_columns] - + self._feature_names[self._feature_names.index(old_column_name) + 1 :] + + [col.name for col in new_columns] + + self._feature_names[self._feature_names.index(old_column_name) + 1:] ), ) @@ -811,7 +834,7 @@ def slice_rows( def sort_columns( self, comparator: Callable[[Column, Column], int] = lambda col1, col2: (col1.name > col2.name) - - (col1.name < col2.name), + - (col1.name < col2.name), ) -> TimeSeries: """ Sort the columns of a `TimeSeries` with the given comparator and return a new `TimeSeries`. From ff995255871380404e300c224665917bebcffbe9 Mon Sep 17 00:00:00 2001 From: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com> Date: Fri, 15 Mar 2024 13:52:43 +0000 Subject: [PATCH 06/19] style: apply automated linter fixes --- src/safeds/data/tabular/containers/_time_series.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/safeds/data/tabular/containers/_time_series.py b/src/safeds/data/tabular/containers/_time_series.py index a3be44c49..874a75eca 100644 --- a/src/safeds/data/tabular/containers/_time_series.py +++ b/src/safeds/data/tabular/containers/_time_series.py @@ -247,6 +247,7 @@ def features(self) -> Table: The table containing the feature columns. """ return self._features + @property def time(self) -> Column: """ @@ -368,7 +369,7 @@ def add_columns_as_features(self, columns: list[Column] | Table) -> TimeSeries: time_name=self.time.name, target_name=self._target.name, feature_names=self._feature_names - + [col.name for col in (columns.to_columns() if isinstance(columns, Table) else columns)], + + [col.name for col in (columns.to_columns() if isinstance(columns, Table) else columns)], ) def add_columns(self, columns: list[Column] | Table) -> TimeSeries: @@ -789,8 +790,8 @@ def replace_column(self, old_column_name: str, new_columns: list[Column]) -> Tim self._feature_names if old_column_name not in self._feature_names else self._feature_names[: self._feature_names.index(old_column_name)] - + [col.name for col in new_columns] - + self._feature_names[self._feature_names.index(old_column_name) + 1:] + + [col.name for col in new_columns] + + self._feature_names[self._feature_names.index(old_column_name) + 1 :] ), ) @@ -834,7 +835,7 @@ def slice_rows( def sort_columns( self, comparator: Callable[[Column, Column], int] = lambda col1, col2: (col1.name > col2.name) - - (col1.name < col2.name), + - (col1.name < col2.name), ) -> TimeSeries: """ Sort the columns of a `TimeSeries` with the given comparator and return a new `TimeSeries`. From b485fe7a238c4b14e1e83524da5462c5e2f839b9 Mon Sep 17 00:00:00 2001 From: Gerhardsa0 Date: Sun, 17 Mar 2024 20:15:15 +0100 Subject: [PATCH 07/19] - changed directory of tests - added tests for properties --- .../_time_series/__init__.py | 0 .../test_should_return_table.png | Bin .../test_should_plot_feature.png | Bin .../test_should_plot_feature_x.png | Bin .../test_should_plot_feature_y.png | Bin .../test_should_return_table.png | Bin .../test_should_return_table_both.png | Bin .../test_should_plot_feature.png | Bin .../test_should_plot_feature_both_set.png | Bin .../test_should_plot_feature_only_x.png | Bin ...st_should_plot_feature_only_y_optional.png | Bin .../test_should_return_table.png | Bin .../_time_series/test_add_column.py | 0 .../test_add_column_as_feature.py | 0 .../_time_series/test_add_columns.py | 0 .../test_add_columns_as_features.py | 0 .../_time_series/test_add_row.py | 0 .../_time_series/test_add_rows.py | 0 .../_time_series/test_as_table.py | 0 .../_time_series/test_features.py | 2 +- .../_time_series/test_filter_rows.py | 0 .../test_from_table_to_time_series.py | 0 .../_time_series/test_from_tagged_table.py | 0 .../_time_series/test_init.py | 2 + .../_time_series/test_keep_only_columns.py | 0 .../_time_series/test_plot_lag.py | 0 .../_time_series/test_plot_lineplot.py | 0 .../_time_series/test_plot_scatterplot.py | 0 .../_time_series/test_remove_columns.py | 0 ...test_remove_columns_with_missing_values.py | 0 ...emove_columns_with_non_numerical_values.py | 0 .../test_remove_duplicate_rows.py | 0 .../test_remove_rows_with_missing_values.py | 0 .../test_remove_rows_with_outliers.py | 0 .../_time_series/test_rename_column.py | 0 .../_time_series/test_replace_column.py | 0 .../_time_series/test_sizeof.py | 0 .../_time_series/test_slice_rows.py | 0 .../_time_series/test_sort_columns.py | 0 .../_table/_time_series/test_target.py | 42 ++++++++++++++++++ .../_time_series/test_time_target.py | 0 .../_time_series/test_transform_column.py | 0 42 files changed, 45 insertions(+), 1 deletion(-) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/__init__.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/__snapshots__/test_plot_lag/test_should_return_table.png (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature.png (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_x.png (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_y.png (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table.png (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table_both.png (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature.png (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_both_set.png (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_x.png (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_y_optional.png (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/__snapshots__/test_plot_scatterplot/test_should_return_table.png (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_add_column.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_add_column_as_feature.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_add_columns.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_add_columns_as_features.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_add_row.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_add_rows.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_as_table.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_features.py (96%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_filter_rows.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_from_table_to_time_series.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_from_tagged_table.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_init.py (98%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_keep_only_columns.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_plot_lag.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_plot_lineplot.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_plot_scatterplot.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_remove_columns.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_remove_columns_with_missing_values.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_remove_columns_with_non_numerical_values.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_remove_duplicate_rows.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_remove_rows_with_missing_values.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_remove_rows_with_outliers.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_rename_column.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_replace_column.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_sizeof.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_slice_rows.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_sort_columns.py (100%) create mode 100644 tests/safeds/data/tabular/containers/_table/_time_series/test_target.py rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_time_target.py (100%) rename tests/safeds/data/tabular/containers/_table/{_tagged_table => }/_time_series/test_transform_column.py (100%) diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__init__.py b/tests/safeds/data/tabular/containers/_table/_time_series/__init__.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__init__.py rename to tests/safeds/data/tabular/containers/_table/_time_series/__init__.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_lag/test_should_return_table.png b/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lag/test_should_return_table.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_lag/test_should_return_table.png rename to tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lag/test_should_return_table.png diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature.png b/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature.png rename to tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature.png diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_x.png b/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_x.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_x.png rename to tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_x.png diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_y.png b/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_y.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_y.png rename to tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_y.png diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table.png b/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table.png rename to tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table.png diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table_both.png b/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table_both.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table_both.png rename to tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table_both.png diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature.png b/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature.png rename to tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature.png diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_both_set.png b/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_both_set.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_both_set.png rename to tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_both_set.png diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_x.png b/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_x.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_x.png rename to tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_x.png diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_y_optional.png b/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_y_optional.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_y_optional.png rename to tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_y_optional.png diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_return_table.png b/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_return_table.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_return_table.png rename to tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_return_table.png diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_column.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_add_column.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_column.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_add_column.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_column_as_feature.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_add_column_as_feature.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_column_as_feature.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_add_column_as_feature.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_columns.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_add_columns.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_columns.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_add_columns.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_columns_as_features.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_add_columns_as_features.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_columns_as_features.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_add_columns_as_features.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_row.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_add_row.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_row.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_add_row.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_rows.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_add_rows.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_add_rows.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_add_rows.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_as_table.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_as_table.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_as_table.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_as_table.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_features.py similarity index 96% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_features.py index 8297956d2..5b75cb317 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_features.py +++ b/tests/safeds/data/tabular/containers/_table/_time_series/test_features.py @@ -39,4 +39,4 @@ ids=["only_target_and_features", "target_features_and_other"], ) def test_should_return_features(time_series: TimeSeries, features: Table) -> None: - assert time_series._features == features + assert time_series.features == features diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_filter_rows.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_filter_rows.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_filter_rows.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_filter_rows.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_table_to_time_series.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_from_table_to_time_series.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_table_to_time_series.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_from_table_to_time_series.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_tagged_table.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_from_tagged_table.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_from_tagged_table.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_from_tagged_table.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_init.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_init.py similarity index 98% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_init.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_init.py index ee79a12c0..fdfc07b2b 100644 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_init.py +++ b/tests/safeds/data/tabular/containers/_table/_time_series/test_init.py @@ -1,6 +1,7 @@ import pytest from safeds.data.tabular.containers import Table, TimeSeries from safeds.exceptions import UnknownColumnNameError +from tests.helpers import assert_that_time_series_are_equal @pytest.mark.parametrize( @@ -148,6 +149,7 @@ def test_should_create_a_time_series( time_series = TimeSeries(data, target_name=target_name, time_name=time_name, feature_names=feature_names) if feature_names is None: feature_names = [] + assert isinstance(time_series, TimeSeries) assert time_series._feature_names == feature_names assert time_series._target.name == target_name diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_keep_only_columns.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_keep_only_columns.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_keep_only_columns.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_keep_only_columns.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_plot_lag.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_plot_lag.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_plot_lag.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_plot_lag.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_plot_lineplot.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_plot_lineplot.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_plot_lineplot.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_plot_lineplot.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_plot_scatterplot.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_plot_scatterplot.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_plot_scatterplot.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_plot_scatterplot.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_remove_columns.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_remove_columns.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_missing_values.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_remove_columns_with_missing_values.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_missing_values.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_remove_columns_with_missing_values.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_non_numerical_values.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_remove_columns_with_non_numerical_values.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_columns_with_non_numerical_values.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_remove_columns_with_non_numerical_values.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_duplicate_rows.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_remove_duplicate_rows.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_duplicate_rows.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_remove_duplicate_rows.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_rows_with_missing_values.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_remove_rows_with_missing_values.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_rows_with_missing_values.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_remove_rows_with_missing_values.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_rows_with_outliers.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_remove_rows_with_outliers.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_remove_rows_with_outliers.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_remove_rows_with_outliers.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_rename_column.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_rename_column.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_rename_column.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_rename_column.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_replace_column.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_replace_column.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_replace_column.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_replace_column.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_sizeof.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_sizeof.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_sizeof.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_sizeof.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_slice_rows.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_slice_rows.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_slice_rows.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_slice_rows.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_sort_columns.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_sort_columns.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_sort_columns.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_sort_columns.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_target.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_target.py new file mode 100644 index 000000000..65334eb71 --- /dev/null +++ b/tests/safeds/data/tabular/containers/_table/_time_series/test_target.py @@ -0,0 +1,42 @@ +import pytest +from safeds.data.tabular.containers import TimeSeries, Column + + +@pytest.mark.parametrize( + ("time_series", "time"), + [ + ( + TimeSeries( + { + "time": [0, 1], + "A": [1, 4], + "B": [2, 5], + "C": [3, 6], + "T": [0, 1], + }, + target_name="T", + time_name="time", + feature_names=["A", "B", "C"], + ), + Column("time", [0, 1]), + ), + ( + TimeSeries( + { + "time": [1, 2], + "A": [1, 4], + "B": [2, 5], + "C": [3, 6], + "T": [0, 1], + }, + target_name="T", + time_name="time", + feature_names=["A", "C"], + ), + Column("time", [1, 2]), + ), + ], + ids=["only_target_and_features", "target_features_and_other"], +) +def test_should_return_features(time_series: TimeSeries, time: Column) -> None: + assert time_series.time == time diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_time_target.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_time_target.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_transform_column.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_transform_column.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_transform_column.py rename to tests/safeds/data/tabular/containers/_table/_time_series/test_transform_column.py From 65165d04d5367029260341c1aee1e9bfb135b0e2 Mon Sep 17 00:00:00 2001 From: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com> Date: Sun, 17 Mar 2024 19:16:52 +0000 Subject: [PATCH 08/19] style: apply automated linter fixes --- .../_table/_time_series/test_init.py | 1 - .../_table/_time_series/test_sizeof.py | 50 +++++++++---------- .../_table/_time_series/test_target.py | 2 +- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_init.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_init.py index fdfc07b2b..aad1be76e 100644 --- a/tests/safeds/data/tabular/containers/_table/_time_series/test_init.py +++ b/tests/safeds/data/tabular/containers/_table/_time_series/test_init.py @@ -1,7 +1,6 @@ import pytest from safeds.data.tabular.containers import Table, TimeSeries from safeds.exceptions import UnknownColumnNameError -from tests.helpers import assert_that_time_series_are_equal @pytest.mark.parametrize( diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_sizeof.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_sizeof.py index fbe310894..1a0ded04b 100644 --- a/tests/safeds/data/tabular/containers/_table/_time_series/test_sizeof.py +++ b/tests/safeds/data/tabular/containers/_table/_time_series/test_sizeof.py @@ -1,37 +1,35 @@ import sys import pytest -from safeds.data.tabular.containers import Table, TimeSeries +from safeds.data.tabular.containers import TimeSeries @pytest.mark.parametrize( "time_series", [ - - TimeSeries( - { - "time": [0, 1, 2], - "feature_1": [3, 9, 6], - "feature_2": [6, 12, 9], - "target": [1, 3, 2], - }, - "target", - "time", - ["feature_1", "feature_2"], - ), - - TimeSeries( - { - "time": [0, 1, 2], - "feature_1": [3, 9, 6], - "feature_2": [6, 12, 9], - "other": [3, 9, 12], - "target": [1, 3, 2], - }, - "target", - "time", - ["feature_1", "feature_2"], - ), + TimeSeries( + { + "time": [0, 1, 2], + "feature_1": [3, 9, 6], + "feature_2": [6, 12, 9], + "target": [1, 3, 2], + }, + "target", + "time", + ["feature_1", "feature_2"], + ), + TimeSeries( + { + "time": [0, 1, 2], + "feature_1": [3, 9, 6], + "feature_2": [6, 12, 9], + "other": [3, 9, 12], + "target": [1, 3, 2], + }, + "target", + "time", + ["feature_1", "feature_2"], + ), ], ids=["normal", "table_with_column_as_non_feature"], ) diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_target.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_target.py index 65334eb71..f1a65de0f 100644 --- a/tests/safeds/data/tabular/containers/_table/_time_series/test_target.py +++ b/tests/safeds/data/tabular/containers/_table/_time_series/test_target.py @@ -1,5 +1,5 @@ import pytest -from safeds.data.tabular.containers import TimeSeries, Column +from safeds.data.tabular.containers import Column, TimeSeries @pytest.mark.parametrize( From f359698730e601838052456539018cd48fc92d29 Mon Sep 17 00:00:00 2001 From: Gerhardsa0 Date: Sun, 17 Mar 2024 20:58:59 +0100 Subject: [PATCH 09/19] -fixed test --- .../tabular/containers/_table/_time_series/test_time_target.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py index e7ccba76a..31dc2b899 100644 --- a/tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py +++ b/tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py @@ -26,5 +26,5 @@ ids=["target"], ) def test_should_return_target(time_series: TimeSeries, target_column: Column, time_column: Column) -> None: - assert time_series._target == target_column + assert time_series.target == target_column assert time_series.time == time_column From 15dbec90551a21d9e3d77fe376e8c75cb4d9e2dc Mon Sep 17 00:00:00 2001 From: Gerhardsa0 Date: Sun, 17 Mar 2024 20:59:31 +0100 Subject: [PATCH 10/19] Revert "-fixed test" This reverts commit f359698730e601838052456539018cd48fc92d29. --- .../tabular/containers/_table/_time_series/test_time_target.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py index 31dc2b899..e7ccba76a 100644 --- a/tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py +++ b/tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py @@ -26,5 +26,5 @@ ids=["target"], ) def test_should_return_target(time_series: TimeSeries, target_column: Column, time_column: Column) -> None: - assert time_series.target == target_column + assert time_series._target == target_column assert time_series.time == time_column From 67e0f1ffc4b70294a5c7bf3888f7d7b2dc6378f1 Mon Sep 17 00:00:00 2001 From: Gerhardsa0 Date: Sun, 17 Mar 2024 20:59:52 +0100 Subject: [PATCH 11/19] -fixed test --- .../tabular/containers/_table/_time_series/test_time_target.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py b/tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py index e7ccba76a..31dc2b899 100644 --- a/tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py +++ b/tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py @@ -26,5 +26,5 @@ ids=["target"], ) def test_should_return_target(time_series: TimeSeries, target_column: Column, time_column: Column) -> None: - assert time_series._target == target_column + assert time_series.target == target_column assert time_series.time == time_column From 4346567ad1b192505bf9033619abaa6d68316fe2 Mon Sep 17 00:00:00 2001 From: Gerhardsa0 Date: Mon, 18 Mar 2024 11:51:01 +0100 Subject: [PATCH 12/19] - refactored time_series directory --- .../{_table => }/_time_series/__init__.py | 0 .../test_plot_lag/test_should_return_table.png | Bin .../test_plot_lineplot/test_should_plot_feature.png | Bin .../test_should_plot_feature_x.png | Bin .../test_should_plot_feature_y.png | Bin .../test_plot_lineplot/test_should_return_table.png | Bin .../test_should_return_table_both.png | Bin .../test_should_plot_feature.png | Bin .../test_should_plot_feature_both_set.png | Bin .../test_should_plot_feature_only_x.png | Bin .../test_should_plot_feature_only_y_optional.png | Bin .../test_should_return_table.png | Bin .../{_table => }/_time_series/test_add_column.py | 0 .../_time_series/test_add_column_as_feature.py | 0 .../{_table => }/_time_series/test_add_columns.py | 0 .../_time_series/test_add_columns_as_features.py | 0 .../{_table => }/_time_series/test_add_row.py | 0 .../{_table => }/_time_series/test_add_rows.py | 0 .../{_table => }/_time_series/test_as_table.py | 0 .../{_table => }/_time_series/test_features.py | 0 .../{_table => }/_time_series/test_filter_rows.py | 0 .../_time_series/test_from_table_to_time_series.py | 0 .../_time_series/test_from_tagged_table.py | 0 .../{_table => }/_time_series/test_init.py | 0 .../_time_series/test_keep_only_columns.py | 0 .../{_table => }/_time_series/test_plot_lag.py | 0 .../{_table => }/_time_series/test_plot_lineplot.py | 0 .../_time_series/test_plot_scatterplot.py | 0 .../_time_series/test_remove_columns.py | 0 .../test_remove_columns_with_missing_values.py | 0 ...test_remove_columns_with_non_numerical_values.py | 0 .../_time_series/test_remove_duplicate_rows.py | 0 .../test_remove_rows_with_missing_values.py | 0 .../_time_series/test_remove_rows_with_outliers.py | 0 .../{_table => }/_time_series/test_rename_column.py | 0 .../_time_series/test_replace_column.py | 0 .../{_table => }/_time_series/test_sizeof.py | 0 .../{_table => }/_time_series/test_slice_rows.py | 0 .../{_table => }/_time_series/test_sort_columns.py | 0 .../{_table => }/_time_series/test_target.py | 0 .../{_table => }/_time_series/test_time_target.py | 0 .../_time_series/test_transform_column.py | 0 42 files changed, 0 insertions(+), 0 deletions(-) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/__init__.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/__snapshots__/test_plot_lag/test_should_return_table.png (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature.png (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_x.png (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_y.png (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table.png (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table_both.png (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature.png (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_both_set.png (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_x.png (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_y_optional.png (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/__snapshots__/test_plot_scatterplot/test_should_return_table.png (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_add_column.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_add_column_as_feature.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_add_columns.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_add_columns_as_features.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_add_row.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_add_rows.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_as_table.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_features.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_filter_rows.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_from_table_to_time_series.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_from_tagged_table.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_init.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_keep_only_columns.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_plot_lag.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_plot_lineplot.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_plot_scatterplot.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_remove_columns.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_remove_columns_with_missing_values.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_remove_columns_with_non_numerical_values.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_remove_duplicate_rows.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_remove_rows_with_missing_values.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_remove_rows_with_outliers.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_rename_column.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_replace_column.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_sizeof.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_slice_rows.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_sort_columns.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_target.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_time_target.py (100%) rename tests/safeds/data/tabular/containers/{_table => }/_time_series/test_transform_column.py (100%) diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/__init__.py b/tests/safeds/data/tabular/containers/_time_series/__init__.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/__init__.py rename to tests/safeds/data/tabular/containers/_time_series/__init__.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lag/test_should_return_table.png b/tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_lag/test_should_return_table.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lag/test_should_return_table.png rename to tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_lag/test_should_return_table.png diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature.png b/tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature.png rename to tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature.png diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_x.png b/tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_x.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_x.png rename to tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_x.png diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_y.png b/tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_y.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_y.png rename to tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_lineplot/test_should_plot_feature_y.png diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table.png b/tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table.png rename to tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table.png diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table_both.png b/tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table_both.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table_both.png rename to tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_lineplot/test_should_return_table_both.png diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature.png b/tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature.png rename to tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature.png diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_both_set.png b/tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_both_set.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_both_set.png rename to tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_both_set.png diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_x.png b/tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_x.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_x.png rename to tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_x.png diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_y_optional.png b/tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_y_optional.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_y_optional.png rename to tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_scatterplot/test_should_plot_feature_only_y_optional.png diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_return_table.png b/tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_scatterplot/test_should_return_table.png similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/__snapshots__/test_plot_scatterplot/test_should_return_table.png rename to tests/safeds/data/tabular/containers/_time_series/__snapshots__/test_plot_scatterplot/test_should_return_table.png diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_add_column.py b/tests/safeds/data/tabular/containers/_time_series/test_add_column.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_add_column.py rename to tests/safeds/data/tabular/containers/_time_series/test_add_column.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_add_column_as_feature.py b/tests/safeds/data/tabular/containers/_time_series/test_add_column_as_feature.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_add_column_as_feature.py rename to tests/safeds/data/tabular/containers/_time_series/test_add_column_as_feature.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_add_columns.py b/tests/safeds/data/tabular/containers/_time_series/test_add_columns.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_add_columns.py rename to tests/safeds/data/tabular/containers/_time_series/test_add_columns.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_add_columns_as_features.py b/tests/safeds/data/tabular/containers/_time_series/test_add_columns_as_features.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_add_columns_as_features.py rename to tests/safeds/data/tabular/containers/_time_series/test_add_columns_as_features.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_add_row.py b/tests/safeds/data/tabular/containers/_time_series/test_add_row.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_add_row.py rename to tests/safeds/data/tabular/containers/_time_series/test_add_row.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_add_rows.py b/tests/safeds/data/tabular/containers/_time_series/test_add_rows.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_add_rows.py rename to tests/safeds/data/tabular/containers/_time_series/test_add_rows.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_as_table.py b/tests/safeds/data/tabular/containers/_time_series/test_as_table.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_as_table.py rename to tests/safeds/data/tabular/containers/_time_series/test_as_table.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_features.py b/tests/safeds/data/tabular/containers/_time_series/test_features.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_features.py rename to tests/safeds/data/tabular/containers/_time_series/test_features.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_filter_rows.py b/tests/safeds/data/tabular/containers/_time_series/test_filter_rows.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_filter_rows.py rename to tests/safeds/data/tabular/containers/_time_series/test_filter_rows.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_from_table_to_time_series.py b/tests/safeds/data/tabular/containers/_time_series/test_from_table_to_time_series.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_from_table_to_time_series.py rename to tests/safeds/data/tabular/containers/_time_series/test_from_table_to_time_series.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_from_tagged_table.py b/tests/safeds/data/tabular/containers/_time_series/test_from_tagged_table.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_from_tagged_table.py rename to tests/safeds/data/tabular/containers/_time_series/test_from_tagged_table.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_init.py b/tests/safeds/data/tabular/containers/_time_series/test_init.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_init.py rename to tests/safeds/data/tabular/containers/_time_series/test_init.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_keep_only_columns.py b/tests/safeds/data/tabular/containers/_time_series/test_keep_only_columns.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_keep_only_columns.py rename to tests/safeds/data/tabular/containers/_time_series/test_keep_only_columns.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_plot_lag.py b/tests/safeds/data/tabular/containers/_time_series/test_plot_lag.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_plot_lag.py rename to tests/safeds/data/tabular/containers/_time_series/test_plot_lag.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_plot_lineplot.py b/tests/safeds/data/tabular/containers/_time_series/test_plot_lineplot.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_plot_lineplot.py rename to tests/safeds/data/tabular/containers/_time_series/test_plot_lineplot.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_plot_scatterplot.py b/tests/safeds/data/tabular/containers/_time_series/test_plot_scatterplot.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_plot_scatterplot.py rename to tests/safeds/data/tabular/containers/_time_series/test_plot_scatterplot.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_remove_columns.py b/tests/safeds/data/tabular/containers/_time_series/test_remove_columns.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_remove_columns.py rename to tests/safeds/data/tabular/containers/_time_series/test_remove_columns.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_remove_columns_with_missing_values.py b/tests/safeds/data/tabular/containers/_time_series/test_remove_columns_with_missing_values.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_remove_columns_with_missing_values.py rename to tests/safeds/data/tabular/containers/_time_series/test_remove_columns_with_missing_values.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_remove_columns_with_non_numerical_values.py b/tests/safeds/data/tabular/containers/_time_series/test_remove_columns_with_non_numerical_values.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_remove_columns_with_non_numerical_values.py rename to tests/safeds/data/tabular/containers/_time_series/test_remove_columns_with_non_numerical_values.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_remove_duplicate_rows.py b/tests/safeds/data/tabular/containers/_time_series/test_remove_duplicate_rows.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_remove_duplicate_rows.py rename to tests/safeds/data/tabular/containers/_time_series/test_remove_duplicate_rows.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_remove_rows_with_missing_values.py b/tests/safeds/data/tabular/containers/_time_series/test_remove_rows_with_missing_values.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_remove_rows_with_missing_values.py rename to tests/safeds/data/tabular/containers/_time_series/test_remove_rows_with_missing_values.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_remove_rows_with_outliers.py b/tests/safeds/data/tabular/containers/_time_series/test_remove_rows_with_outliers.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_remove_rows_with_outliers.py rename to tests/safeds/data/tabular/containers/_time_series/test_remove_rows_with_outliers.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_rename_column.py b/tests/safeds/data/tabular/containers/_time_series/test_rename_column.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_rename_column.py rename to tests/safeds/data/tabular/containers/_time_series/test_rename_column.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_replace_column.py b/tests/safeds/data/tabular/containers/_time_series/test_replace_column.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_replace_column.py rename to tests/safeds/data/tabular/containers/_time_series/test_replace_column.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_sizeof.py b/tests/safeds/data/tabular/containers/_time_series/test_sizeof.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_sizeof.py rename to tests/safeds/data/tabular/containers/_time_series/test_sizeof.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_slice_rows.py b/tests/safeds/data/tabular/containers/_time_series/test_slice_rows.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_slice_rows.py rename to tests/safeds/data/tabular/containers/_time_series/test_slice_rows.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_sort_columns.py b/tests/safeds/data/tabular/containers/_time_series/test_sort_columns.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_sort_columns.py rename to tests/safeds/data/tabular/containers/_time_series/test_sort_columns.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_target.py b/tests/safeds/data/tabular/containers/_time_series/test_target.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_target.py rename to tests/safeds/data/tabular/containers/_time_series/test_target.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py b/tests/safeds/data/tabular/containers/_time_series/test_time_target.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_time_target.py rename to tests/safeds/data/tabular/containers/_time_series/test_time_target.py diff --git a/tests/safeds/data/tabular/containers/_table/_time_series/test_transform_column.py b/tests/safeds/data/tabular/containers/_time_series/test_transform_column.py similarity index 100% rename from tests/safeds/data/tabular/containers/_table/_time_series/test_transform_column.py rename to tests/safeds/data/tabular/containers/_time_series/test_transform_column.py From c14e4f6c10bb00294a1376cf624e1c70c352b45d Mon Sep 17 00:00:00 2001 From: Gerhardsa0 Date: Mon, 18 Mar 2024 14:35:41 +0100 Subject: [PATCH 13/19] - refactored time_series directory --- src/safeds/data/tabular/containers/_time_series.py | 13 ++++--------- .../_time_series/{test_target.py => test_time.py} | 0 2 files changed, 4 insertions(+), 9 deletions(-) rename tests/safeds/data/tabular/containers/_time_series/{test_target.py => test_time.py} (100%) diff --git a/src/safeds/data/tabular/containers/_time_series.py b/src/safeds/data/tabular/containers/_time_series.py index 874a75eca..c5ef90800 100644 --- a/src/safeds/data/tabular/containers/_time_series.py +++ b/src/safeds/data/tabular/containers/_time_series.py @@ -119,6 +119,7 @@ def _from_table( >>> test_table = Table({"date": ["01.01", "01.02", "01.03", "01.04"], "f1": ["a", "b", "c", "a"], "t": [1,2,3,4]}) >>> timeseries = TimeSeries._from_table(test_table, "t", "date", ["f1"]) """ + table = table._as_table() if feature_names is not None and time_name in feature_names: raise ValueError(f"Column '{time_name}' can not be time and feature column.") if feature_names is not None and target_name in feature_names: @@ -128,22 +129,15 @@ def _from_table( raise UnknownColumnNameError([target_name]) result = object.__new__(TimeSeries) - result._data = table._data result._schema = table._schema result._time = table.get_column(time_name) result._target = table.get_column(target_name) - if feature_names is None: - result._feature_names = [] - feature_names = [] - result._features = Table() - if len(feature_names) == 0: + if feature_names is None or len(feature_names) == 0: result._feature_names = [] result._features = Table() else: result._feature_names = feature_names - # for some reason it gets converted into TimeSeries sometimes - table = table._as_table() result._features = table.keep_only_columns(feature_names) # check if time column got added as feature column @@ -190,10 +184,10 @@ def __init__( >>> from safeds.data.tabular.containers import TaggedTable >>> table = TaggedTable({"a": [1, 2, 3], "b": [4, 5, 6]}, "b", ["a"]) """ - _data = Table(data) # Validate inputs super().__init__(data) + _data = Table(data) if feature_names is None: self._features = Table() self._feature_names = [] @@ -895,6 +889,7 @@ def transform_column(self, name: str, transformer: Callable[[Row], Any]) -> Time UnknownColumnNameError If the column does not exist. """ + return TimeSeries._from_table( super().transform_column(name, transformer), time_name=self.time.name, diff --git a/tests/safeds/data/tabular/containers/_time_series/test_target.py b/tests/safeds/data/tabular/containers/_time_series/test_time.py similarity index 100% rename from tests/safeds/data/tabular/containers/_time_series/test_target.py rename to tests/safeds/data/tabular/containers/_time_series/test_time.py From 8bfbc629103cb93ed7d42f68b219fbbbf7880355 Mon Sep 17 00:00:00 2001 From: Gerhardsa0 Date: Mon, 18 Mar 2024 15:47:20 +0100 Subject: [PATCH 14/19] - resolved merge conflict and changed eq and hash because of the new heritage --- src/safeds/data/tabular/containers/_time_series.py | 4 ++-- tests/helpers/_assertions.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/safeds/data/tabular/containers/_time_series.py b/src/safeds/data/tabular/containers/_time_series.py index a77e1dcfe..54d33a7c6 100644 --- a/src/safeds/data/tabular/containers/_time_series.py +++ b/src/safeds/data/tabular/containers/_time_series.py @@ -217,7 +217,7 @@ def __eq__(self, other: object) -> bool: return NotImplemented if self is other: return True - return self.time == other.time and TaggedTable.__eq__(self, other) + return self.time == other.time and self.target == other.target and self.features == other.features and Table.__eq__(self, other) def __hash__(self) -> int: """ @@ -228,7 +228,7 @@ def __hash__(self) -> int: hash : int The hash value. """ - return xxhash.xxh3_64(hash(self.time).to_bytes(8) + TaggedTable.__hash__(self).to_bytes(8)).intdigest() + return xxhash.xxh3_64(hash(self.time).to_bytes(8) + hash(self.target).to_bytes(8) + hash(self.features).to_bytes(8) + Table.__hash__(self).to_bytes(8)).intdigest() def __sizeof__(self) -> int: """ diff --git a/tests/helpers/_assertions.py b/tests/helpers/_assertions.py index 952a808cb..e71d1cdaf 100644 --- a/tests/helpers/_assertions.py +++ b/tests/helpers/_assertions.py @@ -54,7 +54,7 @@ def assert_that_time_series_are_equal(table1: TimeSeries, table2: TimeSeries) -> """ assert table1.schema == table2.schema assert table1._feature_names == table2._feature_names - assert table1._features == table2._features - assert table1._target == table2._target + assert table1.features == table2._features + assert table1.target == table2._target assert table1.time == table2.time assert table1 == table2 From 8091c63a88b5ed779601e69ec6a116a16c934c4a Mon Sep 17 00:00:00 2001 From: Gerhardsa0 Date: Mon, 18 Mar 2024 16:06:36 +0100 Subject: [PATCH 15/19] - --- tests/safeds/data/tabular/containers/_time_series/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tests/safeds/data/tabular/containers/_time_series/__init__.py diff --git a/tests/safeds/data/tabular/containers/_time_series/__init__.py b/tests/safeds/data/tabular/containers/_time_series/__init__.py deleted file mode 100644 index e69de29bb..000000000 From 84555072ad19deb781070804fbc43c9443d91b36 Mon Sep 17 00:00:00 2001 From: Gerhardsa0 Date: Mon, 18 Mar 2024 16:07:03 +0100 Subject: [PATCH 16/19] - readded init --- tests/safeds/data/tabular/containers/_time_series/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/safeds/data/tabular/containers/_time_series/__init__.py diff --git a/tests/safeds/data/tabular/containers/_time_series/__init__.py b/tests/safeds/data/tabular/containers/_time_series/__init__.py new file mode 100644 index 000000000..e69de29bb From d0f0c8f4e51dfd827b9251ca435b04c353e4732f Mon Sep 17 00:00:00 2001 From: Gerhardsa0 Date: Mon, 18 Mar 2024 16:10:13 +0100 Subject: [PATCH 17/19] - deleted old test folder --- .../_tagged_table/_time_series/test_sizeof.py | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_sizeof.py diff --git a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_sizeof.py b/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_sizeof.py deleted file mode 100644 index fbe310894..000000000 --- a/tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_sizeof.py +++ /dev/null @@ -1,39 +0,0 @@ -import sys - -import pytest -from safeds.data.tabular.containers import Table, TimeSeries - - -@pytest.mark.parametrize( - "time_series", - [ - - TimeSeries( - { - "time": [0, 1, 2], - "feature_1": [3, 9, 6], - "feature_2": [6, 12, 9], - "target": [1, 3, 2], - }, - "target", - "time", - ["feature_1", "feature_2"], - ), - - TimeSeries( - { - "time": [0, 1, 2], - "feature_1": [3, 9, 6], - "feature_2": [6, 12, 9], - "other": [3, 9, 12], - "target": [1, 3, 2], - }, - "target", - "time", - ["feature_1", "feature_2"], - ), - ], - ids=["normal", "table_with_column_as_non_feature"], -) -def test_should_size_be_greater_than_normal_object(time_series: TimeSeries) -> None: - assert sys.getsizeof(time_series) > sys.getsizeof(object()) From effff53e7be367464948561fb8c8a5fc73af45ca Mon Sep 17 00:00:00 2001 From: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com> Date: Mon, 18 Mar 2024 15:11:56 +0000 Subject: [PATCH 18/19] style: apply automated linter fixes --- .../data/tabular/containers/_time_series.py | 16 +++-- .../containers/_time_series/test_eq.py | 59 +++++++++++++++---- .../containers/_time_series/test_hash.py | 43 ++++++++++---- 3 files changed, 93 insertions(+), 25 deletions(-) diff --git a/src/safeds/data/tabular/containers/_time_series.py b/src/safeds/data/tabular/containers/_time_series.py index 54d33a7c6..105c29258 100644 --- a/src/safeds/data/tabular/containers/_time_series.py +++ b/src/safeds/data/tabular/containers/_time_series.py @@ -185,7 +185,6 @@ def __init__( >>> from safeds.data.tabular.containers import TaggedTable >>> table = TaggedTable({"a": [1, 2, 3], "b": [4, 5, 6]}, "b", ["a"]) """ - # Validate inputs super().__init__(data) _data = Table(data) @@ -217,7 +216,12 @@ def __eq__(self, other: object) -> bool: return NotImplemented if self is other: return True - return self.time == other.time and self.target == other.target and self.features == other.features and Table.__eq__(self, other) + return ( + self.time == other.time + and self.target == other.target + and self.features == other.features + and Table.__eq__(self, other) + ) def __hash__(self) -> int: """ @@ -228,7 +232,12 @@ def __hash__(self) -> int: hash : int The hash value. """ - return xxhash.xxh3_64(hash(self.time).to_bytes(8) + hash(self.target).to_bytes(8) + hash(self.features).to_bytes(8) + Table.__hash__(self).to_bytes(8)).intdigest() + return xxhash.xxh3_64( + hash(self.time).to_bytes(8) + + hash(self.target).to_bytes(8) + + hash(self.features).to_bytes(8) + + Table.__hash__(self).to_bytes(8), + ).intdigest() def __sizeof__(self) -> int: """ @@ -915,7 +924,6 @@ def transform_column(self, name: str, transformer: Callable[[Row], Any]) -> Time UnknownColumnNameError If the column does not exist. """ - return TimeSeries._from_table( super().transform_column(name, transformer), time_name=self.time.name, diff --git a/tests/safeds/data/tabular/containers/_time_series/test_eq.py b/tests/safeds/data/tabular/containers/_time_series/test_eq.py index e7104ba38..c33043aac 100644 --- a/tests/safeds/data/tabular/containers/_time_series/test_eq.py +++ b/tests/safeds/data/tabular/containers/_time_series/test_eq.py @@ -1,20 +1,52 @@ from typing import Any import pytest -from safeds.data.tabular.containers import Row, Table, TimeSeries, TimeSeries, TaggedTable +from safeds.data.tabular.containers import Row, Table, TaggedTable, TimeSeries @pytest.mark.parametrize( ("table1", "table2", "expected"), [ - (TimeSeries({"a": [], "b": [], "c": []}, "b", "c", ["a"]), TimeSeries({"a": [], "b": [], "c": []}, "b", "c", ["a"]), True), - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), True), - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "c", "d", ["a"]), False), - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "c", ["a"]), TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "e": [10, 11, 12]}, "b", "c", ["a"]), False), - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), TimeSeries({"a": [1, 1, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), False), - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), TimeSeries({"a": ["1", "2", "3"], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), False), - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["c"]), False), - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "c", ["a"]), False), + ( + TimeSeries({"a": [], "b": [], "c": []}, "b", "c", ["a"]), + TimeSeries({"a": [], "b": [], "c": []}, "b", "c", ["a"]), + True, + ), + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), + True, + ), + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "c", "d", ["a"]), + False, + ), + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "c", ["a"]), + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "e": [10, 11, 12]}, "b", "c", ["a"]), + False, + ), + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), + TimeSeries({"a": [1, 1, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), + False, + ), + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), + TimeSeries({"a": ["1", "2", "3"], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), + False, + ), + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["c"]), + False, + ), + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "c", ["a"]), + False, + ), ], ids=[ "rowless table", @@ -27,7 +59,9 @@ "different time", ], ) -def test_should_return_whether_two_tagged_tables_are_equal(table1: TimeSeries, table2: TimeSeries, expected: bool) -> None: +def test_should_return_whether_two_tagged_tables_are_equal( + table1: TimeSeries, table2: TimeSeries, expected: bool, +) -> None: assert (table1.__eq__(table2)) == expected @@ -48,7 +82,10 @@ def test_should_return_true_if_objects_are_identical(table1: TimeSeries) -> None (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), None), (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), Row()), (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), Table()), - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), TaggedTable({"a": [1, 2, 3], "b": [4, 5, 6]}, "b", ["a"])) + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), + TaggedTable({"a": [1, 2, 3], "b": [4, 5, 6]}, "b", ["a"]), + ), ], ids=[ "TimeSeries vs. None", diff --git a/tests/safeds/data/tabular/containers/_time_series/test_hash.py b/tests/safeds/data/tabular/containers/_time_series/test_hash.py index 59fcdd0fa..52cf0181e 100644 --- a/tests/safeds/data/tabular/containers/_time_series/test_hash.py +++ b/tests/safeds/data/tabular/containers/_time_series/test_hash.py @@ -1,15 +1,23 @@ -from typing import Any import pytest -from safeds.data.tabular.containers import Row, Table, TimeSeries, TimeSeries, TaggedTable +from safeds.data.tabular.containers import TimeSeries @pytest.mark.parametrize( ("table1", "table2"), [ - (TimeSeries({"a": [], "b": [], "c": []}, "b", "c", ["a"]), TimeSeries({"a": [], "b": [], "c": []}, "b", "c", ["a"])), - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"])), - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), TimeSeries({"a": [1, 1, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"])), + ( + TimeSeries({"a": [], "b": [], "c": []}, "b", "c", ["a"]), + TimeSeries({"a": [], "b": [], "c": []}, "b", "c", ["a"]), + ), + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), + ), + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), + TimeSeries({"a": [1, 1, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), + ), ], ids=[ "rowless table", @@ -24,11 +32,26 @@ def test_should_return_same_hash_for_equal_time_series(table1: TimeSeries, table @pytest.mark.parametrize( ("table1", "table2"), [ - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "c", "d", ["a"])), - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "c", ["a"]), TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "e": [10, 11, 12]}, "b", "c", ["a"])), - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), TimeSeries({"a": ["1", "2", "3"], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"])), - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["c"])), - (TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "c", ["a"])), + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "c", "d", ["a"]), + ), + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "c", ["a"]), + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "e": [10, 11, 12]}, "b", "c", ["a"]), + ), + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), + TimeSeries({"a": ["1", "2", "3"], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), + ), + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["c"]), + ), + ( + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), + TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "c", ["a"]), + ), ], ids=[ "different target", From 1a9dc149c9d474f6d613c4b1eb14d454a3607e8e Mon Sep 17 00:00:00 2001 From: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com> Date: Mon, 18 Mar 2024 15:13:33 +0000 Subject: [PATCH 19/19] style: apply automated linter fixes --- tests/safeds/data/tabular/containers/_time_series/test_eq.py | 4 +++- .../safeds/data/tabular/containers/_time_series/test_hash.py | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/safeds/data/tabular/containers/_time_series/test_eq.py b/tests/safeds/data/tabular/containers/_time_series/test_eq.py index c33043aac..3c45ee150 100644 --- a/tests/safeds/data/tabular/containers/_time_series/test_eq.py +++ b/tests/safeds/data/tabular/containers/_time_series/test_eq.py @@ -60,7 +60,9 @@ ], ) def test_should_return_whether_two_tagged_tables_are_equal( - table1: TimeSeries, table2: TimeSeries, expected: bool, + table1: TimeSeries, + table2: TimeSeries, + expected: bool, ) -> None: assert (table1.__eq__(table2)) == expected diff --git a/tests/safeds/data/tabular/containers/_time_series/test_hash.py b/tests/safeds/data/tabular/containers/_time_series/test_hash.py index 52cf0181e..94015139b 100644 --- a/tests/safeds/data/tabular/containers/_time_series/test_hash.py +++ b/tests/safeds/data/tabular/containers/_time_series/test_hash.py @@ -1,4 +1,3 @@ - import pytest from safeds.data.tabular.containers import TimeSeries