Fix PEP8 in gate
Zuul openstack-tox-pep8 failed due to several errors [1] - Use bare except. - Use ambiguous variable name 'l'. As pycodestyle doc [2] mentioned, 'Never use the characters 'l', 'O', or 'I' as variable names.'. [1] http://logs.openstack.org/96/477396/3/gate/openstack-tox-pep8/f851c2d/ara/result/57b145af-a103-4982-9e9c-7c93c21b32df/ [2] https://pep8.readthedocs.io/en/latest/_modules/pycodestyle.html Change-Id: Iefdf10245a64e58fa6b5d8174a09fb90f18c81a8
This commit is contained in:
parent
fe734d00da
commit
cc7179c918
|
@ -390,46 +390,46 @@ class TestListFormatter(base.TestBase):
|
|||
@mock.patch('cliff.utils.terminal_width')
|
||||
def test_max_width_80(self, tw):
|
||||
# no resize
|
||||
l = tw.return_value = 80
|
||||
width = tw.return_value = 80
|
||||
self.assertEqual(
|
||||
self._expected_mv[l],
|
||||
self._expected_mv[width],
|
||||
_table_tester_helper(self._col_names, self._col_data),
|
||||
)
|
||||
|
||||
@mock.patch('cliff.utils.terminal_width')
|
||||
def test_max_width_50(self, tw):
|
||||
# resize 1 column
|
||||
l = tw.return_value = 50
|
||||
width = tw.return_value = 50
|
||||
actual = _table_tester_helper(self._col_names, self._col_data,
|
||||
extra_args=['--fit-width'])
|
||||
self.assertEqual(self._expected_mv[l], actual)
|
||||
self.assertEqual(l, len(actual.splitlines()[0]))
|
||||
self.assertEqual(self._expected_mv[width], actual)
|
||||
self.assertEqual(width, len(actual.splitlines()[0]))
|
||||
|
||||
@mock.patch('cliff.utils.terminal_width')
|
||||
def test_max_width_45(self, tw):
|
||||
# resize 2 columns
|
||||
l = tw.return_value = 45
|
||||
width = tw.return_value = 45
|
||||
actual = _table_tester_helper(self._col_names, self._col_data,
|
||||
extra_args=['--fit-width'])
|
||||
self.assertEqual(self._expected_mv[l], actual)
|
||||
self.assertEqual(l, len(actual.splitlines()[0]))
|
||||
self.assertEqual(self._expected_mv[width], actual)
|
||||
self.assertEqual(width, len(actual.splitlines()[0]))
|
||||
|
||||
@mock.patch('cliff.utils.terminal_width')
|
||||
def test_max_width_40(self, tw):
|
||||
# resize all columns
|
||||
l = tw.return_value = 40
|
||||
width = tw.return_value = 40
|
||||
actual = _table_tester_helper(self._col_names, self._col_data,
|
||||
extra_args=['--fit-width'])
|
||||
self.assertEqual(self._expected_mv[l], actual)
|
||||
self.assertEqual(l, len(actual.splitlines()[0]))
|
||||
self.assertEqual(self._expected_mv[width], actual)
|
||||
self.assertEqual(width, len(actual.splitlines()[0]))
|
||||
|
||||
@mock.patch('cliff.utils.terminal_width')
|
||||
def test_max_width_10(self, tw):
|
||||
# resize all columns limited by min_width=8
|
||||
l = tw.return_value = 10
|
||||
width = tw.return_value = 10
|
||||
actual = _table_tester_helper(self._col_names, self._col_data,
|
||||
extra_args=['--fit-width'])
|
||||
self.assertEqual(self._expected_mv[l], actual)
|
||||
self.assertEqual(self._expected_mv[width], actual)
|
||||
# 3 columns each 8 wide, plus table spacing and borders
|
||||
expected_width = 11 * 3 + 1
|
||||
self.assertEqual(expected_width, len(actual.splitlines()[0]))
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
try:
|
||||
from StringIO import StringIO
|
||||
except:
|
||||
except ImportError:
|
||||
from io import StringIO
|
||||
import os
|
||||
import sys
|
||||
|
|
Loading…
Reference in New Issue