Skip to content

Commit

Permalink
style: apply automated linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann authored and github-actions[bot] committed Mar 27, 2023
1 parent 41c2f0c commit ab6722a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/safeds/data/tabular/containers/_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def get_column(self, column_name: str) -> Column:
if self._schema.has_column(column_name):
output_column = Column(
self._data.iloc[
:, [self._schema._get_column_index_by_name(column_name)]
:, [self._schema._get_column_index_by_name(column_name)]
].squeeze(),
column_name,
self._schema.get_type_of_column(column_name),
Expand Down Expand Up @@ -853,8 +853,10 @@ def slice(

def sort_columns(
self,
sorter: Callable[[Column, Column], int] =
lambda col1, col2: (col1.name > col2.name) - (col1.name < col2.name),
sorter: Callable[[Column, Column], int] = lambda col1, col2: (
col1.name > col2.name
)
- (col1.name < col2.name),
) -> Table:
"""
Sort the columns of a `Table` with the given sorter and return a new `Table`. The original table is not
Expand Down
11 changes: 6 additions & 5 deletions tests/safeds/data/tabular/containers/_table/test_sort_rows.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from typing import Callable

import pytest

from safeds.data.tabular.containers import Table, Row, Column
from safeds.data.tabular.containers import Column, Row, Table


@pytest.mark.parametrize(
Expand All @@ -17,9 +16,11 @@
(
Table.from_columns([Column([3, 2, 1], "col1")]),
lambda row1, row2: row1["col1"] - row2["col1"],
Table.from_columns([Column([1, 2, 3], "col1")])
Table.from_columns([Column([1, 2, 3], "col1")]),
),
]
],
)
def test_sort_rows(table: Table, sorter: Callable[[Row, Row], int], expected: Table) -> None:
def test_sort_rows(
table: Table, sorter: Callable[[Row, Row], int], expected: Table
) -> None:
assert table.sort_rows(sorter) == expected

0 comments on commit ab6722a

Please sign in to comment.