From 4650992e489705348e8cc655f61072f7cf41be51 Mon Sep 17 00:00:00 2001 From: ghrps3 <93391512+ghrps3@users.noreply.github.com> Date: Thu, 27 Oct 2022 22:31:15 -0600 Subject: [PATCH 1/2] feat: Add `plain` table style --- table2ascii/preset_style.py | 1 + 1 file changed, 1 insertion(+) diff --git a/table2ascii/preset_style.py b/table2ascii/preset_style.py index 929b11c..460d7b2 100644 --- a/table2ascii/preset_style.py +++ b/table2ascii/preset_style.py @@ -46,3 +46,4 @@ class PresetStyle: ascii_rounded = TableStyle.from_string("/===\|| |=|=||-|-|\|=/") ascii_rounded_box = TableStyle.from_string("/===\||||=||||-|||\||/") markdown = TableStyle.from_string(" ||||-||| ") + plain = TableStyle.from_string(" ") From 42ed2d9a2c981ad5a6392fef7834cc7d88165c81 Mon Sep 17 00:00:00 2001 From: ghrps3 <93391512+ghrps3@users.noreply.github.com> Date: Thu, 27 Oct 2022 22:32:26 -0600 Subject: [PATCH 2/2] Add tests --- tests/test_styles.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_styles.py b/tests/test_styles.py index 30e1670..3becd44 100644 --- a/tests/test_styles.py +++ b/tests/test_styles.py @@ -649,3 +649,21 @@ def test_markdown(): "| SUM | 130 | 140 | 135 | 130 |" ) assert text == expected + + +def test_plain(): + text = t2a( + header=["#", "G", "H", "R", "S"], + body=[["1", "30", "40", "35", "30"], ["2", "30", "40", "35", "30"]], + footer=["SUM", "130", "140", "135", "130"], + first_col_heading=True, + last_col_heading=False, + style=PresetStyle.plain, + ) + expected = ( + " # G H R S \n" + " 1 30 40 35 30 \n" + " 2 30 40 35 30 \n" + " SUM 130 140 135 130 " + ) + assert text == expected