()
| 201 | |
| 202 | |
| 203 | def 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 | |
| 233 | termsize = namedtuple("termsize", ["rows", "columns"]) |
nothing calls this directly
no test coverage detected