diff options
Diffstat (limited to 'tests/test_table_creator.py')
-rw-r--r-- | tests/test_table_creator.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_table_creator.py b/tests/test_table_creator.py index 6e98baa4..70b77bad 100644 --- a/tests/test_table_creator.py +++ b/tests/test_table_creator.py @@ -338,6 +338,18 @@ def test_simple_table_creation(): 'Col 1 Row 2 Col 2 Row 2 ' ) + # Custom column spacing + st = SimpleTable([column_1, column_2], column_spacing=5) + table = st.generate_table(row_data) + + assert table == ( + 'Col 1 Col 2 \n' + '-------------------------------------\n' + 'Col 1 Row 1 Col 2 Row 1 \n' + '\n' + 'Col 1 Row 2 Col 2 Row 2 ' + ) + # Custom divider st = SimpleTable([column_1, column_2], divider_char='─') table = st.generate_table(row_data) @@ -404,6 +416,11 @@ def test_simple_table_creation(): 'Col 1 Row 2 Col 2 Row 2 ' ) + # Invalid column spacing + with pytest.raises(ValueError) as excinfo: + SimpleTable([column_1, column_2], column_spacing=-1) + assert "Column spacing cannot be less than 0" in str(excinfo.value) + # Invalid divider character with pytest.raises(TypeError) as excinfo: SimpleTable([column_1, column_2], divider_char='too long') |