MCPcopy
hub / github.com/dbcli/pgcli / test_format_output_auto_expand

Function test_format_output_auto_expand

tests/test_main.py:203–230  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

201
202
203def test_format_output_auto_expand():
204 settings = OutputSettings(table_format="psql", dcmlfmt="d", floatfmt="g", max_width=100)
205 table_results = format_output("Title", [("abc", "def")], ["head1", "head2"], "test status", settings)
206 table = [
207 "Title",
208 "+-------+-------+",
209 "| head1 | head2 |",
210 "|-------+-------|",
211 "| abc | def |",
212 "+-------+-------+",
213 "test status",
214 ]
215 assert list(table_results) == table
216 expanded_results = format_output(
217 "Title",
218 [("abc", "def")],
219 ["head1", "head2"],
220 "test status",
221 settings._replace(max_width=1),
222 )
223 expanded = [
224 "Title",
225 "-[ RECORD 1 ]-------------------------",
226 "head1 | abc",
227 "head2 | def",
228 "test status",
229 ]
230 assert "\n".join(expanded_results) == "\n".join(expanded)
231
232
233termsize = namedtuple("termsize", ["rows", "columns"])

Callers

nothing calls this directly

Calls 1

format_outputFunction · 0.90

Tested by

no test coverage detected