From cb777906e81f2becf3da2b530dd2cb84ad42fd63 Mon Sep 17 00:00:00 2001 From: daniaHu <129186516+daniaHu@users.noreply.github.com> Date: Fri, 30 Jun 2023 16:01:24 +0200 Subject: [PATCH] feat: added test_repr table tests (#410) 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 --- .../tabular/containers/_table/test_repr.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/safeds/data/tabular/containers/_table/test_repr.py diff --git a/tests/safeds/data/tabular/containers/_table/test_repr.py b/tests/safeds/data/tabular/containers/_table/test_repr.py new file mode 100644 index 000000000..fee0c1d84 --- /dev/null +++ b/tests/safeds/data/tabular/containers/_table/test_repr.py @@ -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