Skip to content

Commit

Permalink
chore: remove wrong type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Nov 26, 2024
1 parent 23fc8b8 commit cbc1ca3
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from safeds.data.tabular.containers import Row, Table
from safeds.data.tabular.containers import Table
from safeds.data.tabular.containers._lazy_vectorized_row import _LazyVectorizedRow


Expand All @@ -15,5 +15,5 @@
],
)
def test_should_return_the_number_of_columns(table: Table, expected: int) -> None:
row: Row[any] = _LazyVectorizedRow(table=table)
row = _LazyVectorizedRow(table=table)
assert row.column_count == expected
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from safeds.data.tabular.containers import Row, Table
from safeds.data.tabular.containers import Table
from safeds.data.tabular.containers._lazy_vectorized_row import _LazyVectorizedRow


Expand All @@ -20,5 +20,5 @@
],
)
def test_should_return_the_column_names(table: Table, expected: list[str]) -> None:
row: Row[any] = _LazyVectorizedRow(table=table)
row = _LazyVectorizedRow(table=table)
assert row.column_names == expected
4 changes: 2 additions & 2 deletions tests/safeds/data/tabular/containers/_row/test_contains.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from safeds.data.tabular.containers import Row, Table
from safeds.data.tabular.containers import Table
from safeds.data.tabular.containers._lazy_vectorized_row import _LazyVectorizedRow


Expand All @@ -19,5 +19,5 @@
],
)
def test_should_return_whether_the_row_has_the_column(table: Table, column_name: str, expected: bool) -> None:
row: Row[any] = _LazyVectorizedRow(table=table)
row = _LazyVectorizedRow(table=table)
assert (column_name in row) == expected
10 changes: 5 additions & 5 deletions tests/safeds/data/tabular/containers/_row/test_eq.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from safeds.data.tabular.containers import Row, Table
from safeds.data.tabular.containers import Table
from safeds.data.tabular.containers._lazy_vectorized_row import _LazyVectorizedRow


Expand All @@ -21,8 +21,8 @@
],
)
def test_should_return_whether_two_rows_are_equal(table1: Table, table2: Table, expected: bool) -> None:
row1: Row[any] = _LazyVectorizedRow(table=table1)
row2: Row[any] = _LazyVectorizedRow(table=table2)
row1 = _LazyVectorizedRow(table=table1)
row2 = _LazyVectorizedRow(table=table2)
assert (row1.__eq__(row2)) == expected


Expand All @@ -38,7 +38,7 @@ def test_should_return_whether_two_rows_are_equal(table1: Table, table2: Table,
],
)
def test_should_return_true_if_rows_are_strict_equal(table: Table, expected: bool) -> None:
row1: Row[any] = _LazyVectorizedRow(table=table)
row1 = _LazyVectorizedRow(table=table)
assert (row1.__eq__(row1)) == expected


Expand All @@ -54,5 +54,5 @@ def test_should_return_true_if_rows_are_strict_equal(table: Table, expected: boo
],
)
def test_should_return_false_if_object_is_other_type(table1: Table, table2: Table) -> None:
row1: Row[any] = _LazyVectorizedRow(table=table1)
row1 = _LazyVectorizedRow(table=table1)
assert (row1.__eq__(table2)) == NotImplemented
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from safeds.data.tabular.containers import Row, Table
from safeds.data.tabular.containers import Table
from safeds.data.tabular.containers._lazy_vectorized_row import _LazyVectorizedRow
from safeds.data.tabular.typing import DataType

Expand All @@ -16,5 +16,5 @@
],
)
def test_should_return_the_type_of_the_column(table: Table, column_name: str, expected: DataType) -> None:
row: Row[any] = _LazyVectorizedRow(table=table)
row = _LazyVectorizedRow(table=table)
assert str(row.get_column_type(column_name)) == expected
4 changes: 2 additions & 2 deletions tests/safeds/data/tabular/containers/_row/test_getitem.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re

import pytest
from safeds.data.tabular.containers import Row, Table
from safeds.data.tabular.containers import Table
from safeds.data.tabular.containers._lazy_vectorized_row import _LazyVectorizedRow
from safeds.exceptions import ColumnNotFoundError

Expand Down Expand Up @@ -41,6 +41,6 @@ def test_should_get_correct_item(table_data: dict, column_name: str, target: int
],
)
def test_should_raise_column_not_found_error(table: Table, column_name: str) -> None:
row: Row[any] = _LazyVectorizedRow(table=table)
row = _LazyVectorizedRow(table=table)
with pytest.raises(ColumnNotFoundError, match=re.escape(f"Could not find column(s):\n - '{column_name}'")):
row[column_name]
4 changes: 2 additions & 2 deletions tests/safeds/data/tabular/containers/_row/test_has_column.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from safeds.data.tabular.containers import Row, Table
from safeds.data.tabular.containers import Table
from safeds.data.tabular.containers._lazy_vectorized_row import _LazyVectorizedRow


Expand All @@ -17,5 +17,5 @@
],
)
def test_should_have_column_name(table: Table, column_name: str, expected: bool) -> None:
row: Row[any] = _LazyVectorizedRow(table=table)
row = _LazyVectorizedRow(table=table)
assert row.has_column(column_name) == expected
6 changes: 3 additions & 3 deletions tests/safeds/data/tabular/containers/_row/test_hash.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from safeds.data.tabular.containers import Row, Table
from safeds.data.tabular.containers import Table
from safeds.data.tabular.containers._lazy_vectorized_row import _LazyVectorizedRow


Expand All @@ -19,6 +19,6 @@
],
)
def test_should_return_consistent_hashes(table1: Table, table2: Table, expected: bool) -> None:
row1: Row[any] = _LazyVectorizedRow(table=table1)
row2: Row[any] = _LazyVectorizedRow(table=table2)
row1 = _LazyVectorizedRow(table=table1)
row2 = _LazyVectorizedRow(table=table2)
assert (hash(row1) == hash(row2)) == expected
4 changes: 2 additions & 2 deletions tests/safeds/data/tabular/containers/_row/test_iter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from safeds.data.tabular.containers import Row, Table
from safeds.data.tabular.containers import Table
from safeds.data.tabular.containers._lazy_vectorized_row import _LazyVectorizedRow


Expand All @@ -17,6 +17,6 @@
],
)
def test_should_return_same_list_of_column_name_with_iter(table: Table, expected: list) -> None:
row: Row[any] = _LazyVectorizedRow(table=table)
row = _LazyVectorizedRow(table=table)
iterable = iter(row)
assert list(iterable) == expected
4 changes: 2 additions & 2 deletions tests/safeds/data/tabular/containers/_row/test_len.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from safeds.data.tabular.containers import Row, Table
from safeds.data.tabular.containers import Table
from safeds.data.tabular.containers._lazy_vectorized_row import _LazyVectorizedRow


Expand All @@ -17,5 +17,5 @@
],
)
def test_should_have_same_length_as_number_of_columns(table: Table, expected: int) -> None:
row: Row[any] = _LazyVectorizedRow(table=table)
row = _LazyVectorizedRow(table=table)
assert len(row) == expected
4 changes: 2 additions & 2 deletions tests/safeds/data/tabular/containers/_row/test_schema.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from safeds.data.tabular.containers import Row, Table
from safeds.data.tabular.containers import Table
from safeds.data.tabular.containers._lazy_vectorized_row import _LazyVectorizedRow


Expand All @@ -17,5 +17,5 @@
],
)
def test_should_return_same_schema(table: Table) -> None:
row: Row[any] = _LazyVectorizedRow(table=table)
row = _LazyVectorizedRow(table=table)
assert table.schema == row.schema
6 changes: 1 addition & 5 deletions tests/safeds/data/tabular/containers/_row/test_sizeof.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import sys
from typing import TYPE_CHECKING, Any

import polars as pl
from safeds.data.tabular.containers._lazy_vectorized_row import _LazyVectorizedRow

if TYPE_CHECKING:
from safeds.data.tabular.containers import Row


def test_should_return_size_greater_than_normal_object() -> None:
cell: Row[Any] = _LazyVectorizedRow(pl.col("a"))
cell = _LazyVectorizedRow(pl.col("a"))
assert sys.getsizeof(cell) > sys.getsizeof(object())

0 comments on commit cbc1ca3

Please sign in to comment.