Skip to content

Commit

Permalink
test: shuffle_rows should work on Tables with multiple rows (#435)
Browse files Browse the repository at this point in the history
Closes #401

### Summary of Changes

Test that `shuffle_rows` also works with a `Table` that contain multiple
rows.

---------

Co-authored-by: megalinter-bot <[email protected]>
Co-authored-by: Severin Paul Höfer <[email protected]>
Co-authored-by: Lars Reimann <[email protected]>
  • Loading branch information
4 people authored Jul 12, 2023
1 parent f0cb6a5 commit d71303d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/safeds/data/tabular/containers/_table/test_shuffle_rows.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@

@pytest.mark.parametrize(
"table",
[(Table({"col1": [1], "col2": [1]})), Table()],
ids=["Table with identical values in rows", "empty"],
[
Table(),
Table({"col1": [1, 3, 5], "col2": [2, 4, 6]}),
Table({"col1": [1], "col2": [2]}),
],
ids=["Empty table", "Table with multiple rows", "Table with one row"],
)
def test_should_shuffle_rows(table: Table) -> None:
result_table = table.shuffle_rows()
assert table.schema == result_table.schema
assert table == result_table
assert table.sort_rows(lambda row1, row2: row1["col1"] - row2["col1"]) == result_table.sort_rows(
lambda row1, row2: row1["col1"] - row2["col1"],
)

0 comments on commit d71303d

Please sign in to comment.