Make bordered() use + for corners if ascii_border=True (#4097)

This commit is contained in:
jack1142 2020-07-23 13:32:41 +02:00 committed by GitHub
parent 5fba9bc4ed
commit 8c484f86a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -165,10 +165,10 @@ def bordered(*columns: Sequence[str], ascii_border: bool = False) -> str:
""" """
borders = { borders = {
"TL": "-" if ascii_border else "", # Top-left "TL": "+" if ascii_border else "", # Top-left
"TR": "-" if ascii_border else "", # Top-right "TR": "+" if ascii_border else "", # Top-right
"BL": "-" if ascii_border else "", # Bottom-left "BL": "+" if ascii_border else "", # Bottom-left
"BR": "-" if ascii_border else "", # Bottom-right "BR": "+" if ascii_border else "", # Bottom-right
"HZ": "-" if ascii_border else "", # Horizontal "HZ": "-" if ascii_border else "", # Horizontal
"VT": "|" if ascii_border else "", # Vertical "VT": "|" if ascii_border else "", # Vertical
} }

View File

@ -55,11 +55,11 @@ def test_bordered_asymmetrical_2():
def test_bordered_ascii(): def test_bordered_ascii():
expected = textwrap.dedent( expected = textwrap.dedent(
"""\ """\
---------------- --------------- +--------------+ +-------------+
|one | |four | |one | |four |
|two | |five | |two | |five |
|three | |six | |three | |six |
---------------- ---------------""" +--------------+ +-------------+"""
) )
col1, col2 = ["one", "two", "three"], ["four", "five", "six"] col1, col2 = ["one", "two", "three"], ["four", "five", "six"]
assert chat_formatting.bordered(col1, col2, ascii_border=True) == expected assert chat_formatting.bordered(col1, col2, ascii_border=True) == expected