Skip to content

Commit 6390f42

Browse files
authored
feat: Added plain table style (#50)
1 parent 2bcf302 commit 6390f42

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

table2ascii/preset_style.py

+1
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ class PresetStyle:
4646
ascii_rounded = TableStyle.from_string("/===\|| |=|=||-|-|\|=/")
4747
ascii_rounded_box = TableStyle.from_string("/===\||||=||||-|||\||/")
4848
markdown = TableStyle.from_string(" ||||-||| ")
49+
plain = TableStyle.from_string(" ")

tests/test_styles.py

+18
Original file line numberDiff line numberDiff line change
@@ -649,3 +649,21 @@ def test_markdown():
649649
"| SUM | 130 | 140 | 135 | 130 |"
650650
)
651651
assert text == expected
652+
653+
654+
def test_plain():
655+
text = t2a(
656+
header=["#", "G", "H", "R", "S"],
657+
body=[["1", "30", "40", "35", "30"], ["2", "30", "40", "35", "30"]],
658+
footer=["SUM", "130", "140", "135", "130"],
659+
first_col_heading=True,
660+
last_col_heading=False,
661+
style=PresetStyle.plain,
662+
)
663+
expected = (
664+
" # G H R S \n"
665+
" 1 30 40 35 30 \n"
666+
" 2 30 40 35 30 \n"
667+
" SUM 130 140 135 130 "
668+
)
669+
assert text == expected

0 commit comments

Comments
 (0)