MCPcopy Create free account
hub / github.com/dbcli/mssql-cli / test_format_output_auto_expand

Method test_format_output_auto_expand

tests/test_main.py:103–141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101
102 @staticmethod
103 def test_format_output_auto_expand():
104 mssqlcli = create_mssql_cli()
105 settings = OutputSettings(
106 table_format='psql',
107 dcmlfmt='d',
108 floatfmt='g',
109 max_width=100)
110 table_results = mssqlcli.format_output(
111 'Title',
112 [('abc', 'def')],
113 ['head1', 'head2'],
114 'test status',
115 settings
116 )
117 table = [
118 'Title',
119 '+---------+---------+',
120 '| head1 | head2 |',
121 '|---------+---------|',
122 '| abc | def |',
123 '+---------+---------+',
124 'test status'
125 ]
126 assert list(table_results) == table
127 expanded_results = mssqlcli.format_output(
128 'Title',
129 [('abc', 'def')],
130 ['head1', 'head2'],
131 'test status',
132 settings._replace(max_width=1)
133 )
134 expanded = [
135 'Title',
136 '-[ RECORD 1 ]-------------------------',
137 'head1 | abc',
138 'head2 | def',
139 'test status'
140 ]
141 assert list(expanded_results) == expanded
142
143 @staticmethod
144 def test_missing_rc_dir():

Callers

nothing calls this directly

Calls 2

create_mssql_cliFunction · 0.90
format_outputMethod · 0.80

Tested by

no test coverage detected