Cleaned pep8 errors

This commit is contained in:
Ian Knight 2016-03-21 01:04:52 +10:30
parent 79b4c474d6
commit 4f1a074546
1 changed files with 32 additions and 41 deletions

View File

@ -33,7 +33,6 @@ from tests.functional import MagicMock, patch, call
class TestListPreviewWidget(TestCase):
def setUp(self):
"""
Mock out stuff for all the tests
@ -43,7 +42,6 @@ class TestListPreviewWidget(TestCase):
self.mocked_parent.width.return_value = 100
self.addCleanup(self.parent_patcher.stop)
def new_list_preview_widget_test(self):
"""
Test that creating an instance of ListPreviewWidget works
@ -56,8 +54,6 @@ class TestListPreviewWidget(TestCase):
# THEN: The object is not None, and the _setup() method was called.
self.assertIsNotNone(list_preview_widget, 'The ListPreviewWidget object should not be None')
self.assertEquals(list_preview_widget.screen_ratio, 1, 'Should not be called')
#self.mocked_setup.assert_called_with(1)
@patch(u'openlp.core.ui.listpreviewwidget.Settings')
@patch(u'openlp.core.ui.listpreviewwidget.ListPreviewWidget.viewport')
@ -66,7 +62,7 @@ class TestListPreviewWidget(TestCase):
def replace_recalculate_layout_test_text(self, mocked_setRowHeight, mocked_resizeRowsToContents,
mocked_viewport, mocked_Settings):
"""
Test if "Max height for non-text slides in slide controller" enabled, text-based slides not affected in replace_service_item and __recalculate_layout.
Test if "Max height for non-text slides..." enabled, txt slides unchanged in replace_service_item & __recalc...
"""
# GIVEN: A setting to adjust "Max height for non-text slides in slide controller",
# a text ServiceItem and a ListPreviewWidget.
@ -98,7 +94,6 @@ class TestListPreviewWidget(TestCase):
self.assertEquals(mocked_resizeRowsToContents.call_count, 2, 'Should be called')
self.assertEquals(mocked_setRowHeight.call_count, 0, 'Should not be called')
@patch(u'openlp.core.ui.listpreviewwidget.Settings')
@patch(u'openlp.core.ui.listpreviewwidget.ListPreviewWidget.viewport')
@patch(u'openlp.core.ui.listpreviewwidget.ListPreviewWidget.resizeRowsToContents')
@ -106,7 +101,7 @@ class TestListPreviewWidget(TestCase):
def replace_recalculate_layout_test_img(self, mocked_setRowHeight, mocked_resizeRowsToContents,
mocked_viewport, mocked_Settings):
"""
Test if "Max height for non-text slides in slide controller" disabled, image-based slides not resized to the max-height in replace_service_item and __recalculate_layout.
Test if "Max height for non-text slides..." disabled, img slides unchanged in replace_service_item & __recalc...
"""
# GIVEN: A setting to adjust "Max height for non-text slides in slide controller",
# an image ServiceItem and a ListPreviewWidget.
@ -139,7 +134,6 @@ class TestListPreviewWidget(TestCase):
calls = [call(0, 200), call(1, 200), call(0, 400), call(1, 400)]
mocked_setRowHeight.assert_has_calls(calls)
@patch(u'openlp.core.ui.listpreviewwidget.Settings')
@patch(u'openlp.core.ui.listpreviewwidget.ListPreviewWidget.viewport')
@patch(u'openlp.core.ui.listpreviewwidget.ListPreviewWidget.resizeRowsToContents')
@ -147,7 +141,7 @@ class TestListPreviewWidget(TestCase):
def replace_recalculate_layout_test_img_max(self, mocked_setRowHeight, mocked_resizeRowsToContents,
mocked_viewport, mocked_Settings):
"""
Test if "Max height for non-text slides in slide controller" enabled, image-based slides are resized to the max-height in replace_service_item and __recalculate_layout.
Test if "Max height for non-text slides..." enabled, img slides resized in replace_service_item & __recalc...
"""
# GIVEN: A setting to adjust "Max height for non-text slides in slide controller",
@ -180,7 +174,6 @@ class TestListPreviewWidget(TestCase):
calls = [call(0, 100), call(1, 100), call(0, 100), call(1, 100)]
mocked_setRowHeight.assert_has_calls(calls)
@patch(u'openlp.core.ui.listpreviewwidget.Settings')
@patch(u'openlp.core.ui.listpreviewwidget.ListPreviewWidget.viewport')
@patch(u'openlp.core.ui.listpreviewwidget.ListPreviewWidget.resizeRowsToContents')
@ -189,7 +182,7 @@ class TestListPreviewWidget(TestCase):
def row_resized_test_text(self, mocked_cellWidget, mocked_setRowHeight, mocked_resizeRowsToContents,
mocked_viewport, mocked_Settings):
"""
Test if "Max height for non-text slides in slide controller" enabled, text-based slides not affected in row_resized.
Test if "Max height for non-text slides..." enabled, text-based slides not affected in row_resized.
"""
# GIVEN: A setting to adjust "Max height for non-text slides in slide controller",
# a text ServiceItem and a ListPreviewWidget.
@ -222,7 +215,6 @@ class TestListPreviewWidget(TestCase):
# THEN: self.cellWidget(row, 0).children()[1].setMaximumWidth() should not be called
self.assertEquals(mocked_cellWidget_child.setMaximumWidth.call_count, 0, 'Should not be called')
@patch(u'openlp.core.ui.listpreviewwidget.Settings')
@patch(u'openlp.core.ui.listpreviewwidget.ListPreviewWidget.viewport')
@patch(u'openlp.core.ui.listpreviewwidget.ListPreviewWidget.resizeRowsToContents')
@ -231,7 +223,7 @@ class TestListPreviewWidget(TestCase):
def row_resized_test_img(self, mocked_cellWidget, mocked_setRowHeight, mocked_resizeRowsToContents,
mocked_viewport, mocked_Settings):
"""
Test if "Max height for non-text slides in slide controller" disabled, image-based slides not affected in row_resized.
Test if "Max height for non-text slides..." disabled, image-based slides not affected in row_resized.
"""
# GIVEN: A setting to adjust "Max height for non-text slides in slide controller",
# an image ServiceItem and a ListPreviewWidget.
@ -264,7 +256,6 @@ class TestListPreviewWidget(TestCase):
# THEN: self.cellWidget(row, 0).children()[1].setMaximumWidth() should not be called
self.assertEquals(mocked_cellWidget_child.setMaximumWidth.call_count, 0, 'Should not be called')
@patch(u'openlp.core.ui.listpreviewwidget.Settings')
@patch(u'openlp.core.ui.listpreviewwidget.ListPreviewWidget.viewport')
@patch(u'openlp.core.ui.listpreviewwidget.ListPreviewWidget.resizeRowsToContents')
@ -273,7 +264,7 @@ class TestListPreviewWidget(TestCase):
def row_resized_test_img_max(self, mocked_cellWidget, mocked_setRowHeight, mocked_resizeRowsToContents,
mocked_viewport, mocked_Settings):
"""
Test if "Max height for non-text slides in slide controller" enabled, image-based slides are scaled in row_resized.
Test if "Max height for non-text slides..." enabled, image-based slides are scaled in row_resized.
"""
# GIVEN: A setting to adjust "Max height for non-text slides in slide controller",
# an image ServiceItem and a ListPreviewWidget.