Skip to content

Commit

Permalink
feat: added test_repr table tests (#410)
Browse files Browse the repository at this point in the history
Closes #349 

### Summary of Changes

Added a test_repr.py file to
`tests/safeds/data/tabular/containers/_table` that tests the fuction
__repr__ of class Table
  • Loading branch information
daniaHu committed Jun 30, 2023
1 parent c5d75df commit cb77790
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/safeds/data/tabular/containers/_table/test_repr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest
from safeds.data.tabular.containers import Table


@pytest.mark.parametrize(
("table", "expected"),
[
(Table(), "Empty DataFrame\nColumns: []\nIndex: []"),
(Table({"col1": [0]}), " col1\n0 0"),
(Table({"col1": [0, "1"], "col2": ["a", "b"]}), " col1 col2\n0 0 a\n1 1 b"),
],
ids=[
"empty table",
"table with one row",
"table with multiple rows",
],
)
def test_should_return_a_string_representation(table: Table, expected: str) -> None:
assert repr(table) == expected

0 comments on commit cb77790

Please sign in to comment.