1
0
Fork 0

Merging upstream version 2.3.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-07 00:57:10 +01:00
parent 9f89672eb0
commit 22daebc5ff
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
7 changed files with 77 additions and 12 deletions

View file

@ -21,6 +21,41 @@ def test_tabular_output_formatter():
["hi", Decimal("1.1")],
["Pablo\rß\n", 0],
]
expected = dedent(
"""\
+-------+---------+
| text | numeric |
+-------+---------+
| abc | 1 |
| defg | 11.1 |
| hi | 1.1 |
| Pablo | 0 |
| ß | |
+-------+---------+"""
)
print(expected)
print(
"\n".join(
TabularOutputFormatter().format_output(
iter(data), headers, format_name="ascii"
)
)
)
assert expected == "\n".join(
TabularOutputFormatter().format_output(iter(data), headers, format_name="ascii")
)
def test_tabular_output_escaped():
"""Test the ascii_escaped output format."""
headers = ["text", "numeric"]
data = [
["abc", Decimal(1)],
["defg", Decimal("11.1")],
["hi", Decimal("1.1")],
["Pablo\rß\n", 0],
]
expected = dedent(
"""\
+------------+---------+
@ -37,12 +72,14 @@ def test_tabular_output_formatter():
print(
"\n".join(
TabularOutputFormatter().format_output(
iter(data), headers, format_name="ascii"
iter(data), headers, format_name="ascii_escaped"
)
)
)
assert expected == "\n".join(
TabularOutputFormatter().format_output(iter(data), headers, format_name="ascii")
TabularOutputFormatter().format_output(
iter(data), headers, format_name="ascii_escaped"
)
)