1
1
mirror of https://github.com/dbcli/pgcli.git synced 2024-10-06 10:17:15 +03:00

Reformat code for readability and linter happiness

This commit is contained in:
Joakim Koljonen 2017-08-06 19:24:16 +02:00
parent c616a8b422
commit 13d8893427
No known key found for this signature in database
GPG Key ID: AF0327B5131CD164

View File

@ -54,7 +54,15 @@ def test_format_output():
settings = OutputSettings(table_format='psql', dcmlfmt='d', floatfmt='g')
results = format_output('Title', [('abc', 'def')], ['head1', 'head2'],
'test status', settings)
expected = ['Title', '+---------+---------+\n| head1 | head2 |\n|---------+---------|\n| abc | def |\n+---------+---------+', 'test status']
expected = [
'Title',
'+---------+---------+\n'
'| head1 | head2 |\n'
'|---------+---------|\n'
'| abc | def |\n'
'+---------+---------+',
'test status'
]
assert results == expected
@ -109,12 +117,30 @@ def test_format_output_auto_expand():
table_format='psql', dcmlfmt='d', floatfmt='g', max_width=100)
table_results = format_output('Title', [('abc', 'def')],
['head1', 'head2'], 'test status', settings)
table = ['Title', '+---------+---------+\n| head1 | head2 |\n|---------+---------|\n| abc | def |\n+---------+---------+', 'test status']
table = [
'Title',
'+---------+---------+\n'
'| head1 | head2 |\n'
'|---------+---------|\n'
'| abc | def |\n'
'+---------+---------+',
'test status'
]
assert table_results == table
expanded_results = format_output('Title', [('abc', 'def')],
['head1', 'head2'], 'test status', settings._replace(max_width=1))
expanded_results = format_output(
'Title',
[('abc', 'def')],
['head1', 'head2'],
'test status',
settings._replace(max_width=1)
)
expanded = [
'Title', u'-[ RECORD 1 ]-------------------------\nhead1 | abc\nhead2 | def\n', 'test status']
'Title',
u'-[ RECORD 1 ]-------------------------\n'
'head1 | abc\n'
'head2 | def\n',
'test status'
]
assert expanded_results == expanded