Status: | Merged |
---|---|
Merged at revision: | 2801 |
Proposed branch: | lp:~trb143/openlp/asserts2 |
Merge into: | lp:openlp |
Diff against target: |
4867 lines (+819/-868) 74 files modified
tests/functional/openlp_core/lib/test_image_manager.py (+5/-5) tests/functional/openlp_core/lib/test_lib.py (+5/-5) tests/functional/openlp_core/lib/test_path.py (+3/-3) tests/functional/openlp_core/test_app.py (+1/-1) tests/functional/openlp_core/ui/test_mainwindow.py (+3/-3) tests/functional/openlp_plugins/alerts/test_manager.py (+3/-3) tests/functional/openlp_plugins/bibles/test_bibleserver.py (+7/-9) tests/functional/openlp_plugins/bibles/test_csvimport.py (+35/-35) tests/functional/openlp_plugins/bibles/test_lib.py (+21/-21) tests/functional/openlp_plugins/bibles/test_manager.py (+2/-2) tests/functional/openlp_plugins/bibles/test_mediaitem.py (+95/-95) tests/functional/openlp_plugins/bibles/test_opensongimport.py (+32/-35) tests/functional/openlp_plugins/bibles/test_osisimport.py (+22/-24) tests/functional/openlp_plugins/bibles/test_swordimport.py (+2/-2) tests/functional/openlp_plugins/bibles/test_versereferencelist.py (+14/-17) tests/functional/openlp_plugins/bibles/test_zefaniaimport.py (+3/-3) tests/functional/openlp_plugins/custom/test_mediaitem.py (+5/-5) tests/functional/openlp_plugins/images/test_imagetab.py (+5/-5) tests/functional/openlp_plugins/images/test_lib.py (+16/-17) tests/functional/openlp_plugins/images/test_upgrade.py (+2/-2) tests/functional/openlp_plugins/media/test_mediaitem.py (+2/-2) tests/functional/openlp_plugins/media/test_mediaplugin.py (+4/-4) tests/functional/openlp_plugins/presentations/test_impresscontroller.py (+10/-13) tests/functional/openlp_plugins/presentations/test_mediaitem.py (+5/-5) tests/functional/openlp_plugins/presentations/test_messagelistener.py (+4/-4) tests/functional/openlp_plugins/presentations/test_pdfcontroller.py (+12/-12) tests/functional/openlp_plugins/presentations/test_powerpointcontroller.py (+15/-16) tests/functional/openlp_plugins/presentations/test_pptviewcontroller.py (+6/-7) tests/functional/openlp_plugins/presentations/test_presentationcontroller.py (+15/-15) tests/functional/openlp_plugins/songs/test_db.py (+18/-20) tests/functional/openlp_plugins/songs/test_editsongform.py (+2/-2) tests/functional/openlp_plugins/songs/test_editverseform.py (+5/-5) tests/functional/openlp_plugins/songs/test_ewimport.py (+24/-28) tests/functional/openlp_plugins/songs/test_foilpresenterimport.py (+3/-3) tests/functional/openlp_plugins/songs/test_lib.py (+25/-25) tests/functional/openlp_plugins/songs/test_mediaitem.py (+24/-26) tests/functional/openlp_plugins/songs/test_mediashout.py (+14/-14) tests/functional/openlp_plugins/songs/test_openlpimporter.py (+4/-4) tests/functional/openlp_plugins/songs/test_openlyricsexport.py (+4/-6) tests/functional/openlp_plugins/songs/test_openlyricsimport.py (+8/-9) tests/functional/openlp_plugins/songs/test_openoffice.py (+2/-2) tests/functional/openlp_plugins/songs/test_opensongimport.py (+6/-6) tests/functional/openlp_plugins/songs/test_opsproimport.py (+9/-9) tests/functional/openlp_plugins/songs/test_songbeamerimport.py (+24/-25) tests/functional/openlp_plugins/songs/test_songformat.py (+12/-13) tests/functional/openlp_plugins/songs/test_songselect.py (+92/-97) tests/functional/openlp_plugins/songs/test_songshowplusimport.py (+12/-12) tests/functional/openlp_plugins/songs/test_worshipcenterproimport.py (+5/-7) tests/functional/openlp_plugins/songs/test_zionworximport.py (+1/-1) tests/functional/openlp_plugins/songusage/test_songusage.py (+7/-7) tests/helpers/songfileimport.py (+13/-13) tests/interfaces/openlp_core/lib/test_pluginmanager.py (+8/-8) tests/interfaces/openlp_core/ui/media/vendor/test_mediainfoWrapper.py (+1/-2) tests/interfaces/openlp_core/ui/test_filerenamedialog.py (+4/-4) tests/interfaces/openlp_core/ui/test_projectormanager.py (+8/-9) tests/interfaces/openlp_core/ui/test_projectorsourceform.py (+5/-8) tests/interfaces/openlp_core/ui/test_servicemanager.py (+12/-12) tests/interfaces/openlp_core/ui/test_servicenotedialog.py (+3/-3) tests/interfaces/openlp_core/ui/test_shortcutlistform.py (+8/-8) tests/interfaces/openlp_core/ui/test_starttimedialog.py (+26/-30) tests/interfaces/openlp_core/ui/test_thememanager.py (+1/-1) tests/interfaces/openlp_core/widgets/test_edits.py (+8/-8) tests/interfaces/openlp_core/widgets/test_views.py (+5/-5) tests/interfaces/openlp_plugins/bibles/forms/test_bibleimportform.py (+1/-1) tests/interfaces/openlp_plugins/bibles/test_lib_http.py (+17/-21) tests/interfaces/openlp_plugins/bibles/test_lib_manager.py (+4/-4) tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py (+6/-6) tests/interfaces/openlp_plugins/custom/forms/test_customform.py (+2/-2) tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py (+9/-9) tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py (+9/-9) tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py (+9/-9) tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py (+3/-3) tests/utils/test_bzr_tags.py (+1/-1) tests/utils/test_pylint.py (+1/-1) |
To merge this branch: | bzr merge lp:~trb143/openlp/asserts2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Phill | Approve | ||
Review via email: mp+335577@code.launchpad.net |
This proposal supersedes a proposal from 2017-12-23.
Commit message
Description of the change
All tests migrated to assert from self.assert except projection
All tests pass on linux with pytest and nose2
lp:~trb143/openlp/asserts2 (revision 2839)
https:/
https:/
File "./scripts/
main()
File "./scripts/
jenkins_
File "./scripts/
if not self.__
File "./scripts/
self.
File "./scripts/
raise Exception('Build has not started yet, it may be stuck in the queue.')
Exception: Build has not started yet, it may be stuck in the queue.
Phill (phill-ridout) wrote : Posted in a previous version of this proposal | # |
Phill (phill-ridout) : | # |
Preview Diff
1 | === modified file 'tests/functional/openlp_core/lib/test_image_manager.py' |
2 | --- tests/functional/openlp_core/lib/test_image_manager.py 2017-12-18 17:10:04 +0000 |
3 | +++ tests/functional/openlp_core/lib/test_image_manager.py 2017-12-24 07:19:49 +0000 |
4 | @@ -72,13 +72,13 @@ |
5 | image = self.image_manager.get_image(full_path, 'church.jpg') |
6 | |
7 | # THEN returned record is a type of image |
8 | - self.assertEqual(isinstance(image, QtGui.QImage), True, 'The returned object should be a QImage') |
9 | + assert isinstance(image, QtGui.QImage), 'The returned object should be a QImage' |
10 | |
11 | # WHEN: The image bytes are requested. |
12 | byte_array = self.image_manager.get_image_bytes(full_path, 'church.jpg') |
13 | |
14 | # THEN: Type should be a str. |
15 | - self.assertEqual(isinstance(byte_array, str), True, 'The returned object should be a str') |
16 | + assert isinstance(byte_array, str), 'The returned object should be a str' |
17 | |
18 | # WHEN the image is retrieved has not been loaded |
19 | # THEN a KeyError is thrown |
20 | @@ -104,14 +104,14 @@ |
21 | self.image_manager.add_image(full_path, 'church.jpg', None, 100, 100) |
22 | |
23 | # THEN: the cache should contain two pictures |
24 | - self.assertEqual(len(self.image_manager._cache), 2, |
25 | - 'Image manager should consider two dimensions of the same picture as different') |
26 | + assert len(self.image_manager._cache) == 2, \ |
27 | + 'Image manager should consider two dimensions of the same picture as different' |
28 | |
29 | # WHEN: adding the same image with first dimensions |
30 | self.image_manager.add_image(full_path, 'church.jpg', None, 80, 80) |
31 | |
32 | # THEN: the cache should still contain only two pictures |
33 | - self.assertEqual(len(self.image_manager._cache), 2, 'Same dimensions should not be added again') |
34 | + assert len(self.image_manager._cache) == 2, 'Same dimensions should not be added again' |
35 | |
36 | # WHEN: calling with correct image, but wrong dimensions |
37 | with self.assertRaises(KeyError) as context: |
38 | |
39 | === modified file 'tests/functional/openlp_core/lib/test_lib.py' |
40 | --- tests/functional/openlp_core/lib/test_lib.py 2017-12-18 17:10:04 +0000 |
41 | +++ tests/functional/openlp_core/lib/test_lib.py 2017-12-24 07:19:49 +0000 |
42 | @@ -291,7 +291,7 @@ |
43 | icon = create_thumb(image_path, thumb_path, size=thumb_size) |
44 | |
45 | # THEN: Check if the thumb was created and scaled to the given size. |
46 | - self.assertTrue(thumb_path.exists(), 'Test was not ran, because the thumb already exists') |
47 | + assert thumb_path.exists() is True, 'Test was not ran, because the thumb already exists' |
48 | assert isinstance(icon, QtGui.QIcon), 'The icon should be a QIcon' |
49 | assert icon.isNull() is False, 'The icon should not be null' |
50 | assert thumb_size == QtGui.QImageReader(str(thumb_path)).size(), 'The thumb should have the given size' |
51 | @@ -325,7 +325,7 @@ |
52 | icon = create_thumb(image_path, thumb_path) |
53 | |
54 | # THEN: Check if the thumb was created, retaining its aspect ratio. |
55 | - self.assertTrue(thumb_path.exists(), 'Test was not ran, because the thumb already exists') |
56 | + assert thumb_path.exists() is True, 'Test was not ran, because the thumb already exists' |
57 | assert isinstance(icon, QtGui.QIcon), 'The icon should be a QIcon' |
58 | assert icon.isNull() is False, 'The icon should not be null' |
59 | assert expected_size == QtGui.QImageReader(str(thumb_path)).size(), 'The thumb should have the given size' |
60 | @@ -430,7 +430,7 @@ |
61 | icon = create_thumb(image_path, thumb_path, size=thumb_size) |
62 | |
63 | # THEN: Check if the thumb was created, retaining its aspect ratio. |
64 | - self.assertTrue(thumb_path.exists(), 'Test was not ran, because the thumb already exists') |
65 | + assert thumb_path.exists() is True, 'Test was not ran, because the thumb already exists' |
66 | assert isinstance(icon, QtGui.QIcon), 'The icon should be a QIcon' |
67 | assert icon.isNull() is False, 'The icon should not be null' |
68 | assert expected_size == QtGui.QImageReader(str(thumb_path)).size(), 'The thumb should have the given size' |
69 | @@ -468,7 +468,7 @@ |
70 | icon = create_thumb(image_path, thumb_path, size=None) |
71 | |
72 | # THEN: Check if the thumb was created with aspect ratio of 1. |
73 | - self.assertTrue(thumb_path.exists(), 'Test was not ran, because the thumb already exists') |
74 | + assert thumb_path.exists() is True, 'Test was not ran, because the thumb already exists' |
75 | assert isinstance(icon, QtGui.QIcon), 'The icon should be a QIcon' |
76 | assert icon.isNull() is False, 'The icon should not be null' |
77 | assert expected_size_1 == QtGui.QImageReader(str(thumb_path)).size(), 'The thumb should have the given size' |
78 | @@ -789,7 +789,7 @@ |
79 | ret = compare_chord_lyric(chord, lyrics) |
80 | |
81 | # THEN: The returned value should 0 because the lyric is longer than the chord |
82 | - self.assertEquals(0, ret, 'The returned value should 0 because the lyric is longer than the chord') |
83 | + assert 0 == ret, 'The returned value should 0 because the lyric is longer than the chord' |
84 | |
85 | def test_compare_chord_lyric_long_chord(self): |
86 | """ |
87 | |
88 | === modified file 'tests/functional/openlp_core/lib/test_path.py' |
89 | --- tests/functional/openlp_core/lib/test_path.py 2017-08-25 20:03:25 +0000 |
90 | +++ tests/functional/openlp_core/lib/test_path.py 2017-12-24 07:19:49 +0000 |
91 | @@ -52,7 +52,7 @@ |
92 | result = path_to_str(None) |
93 | |
94 | # THEN: `path_to_str` should return an empty string |
95 | - self.assertEqual(result, '') |
96 | + assert result == '' |
97 | |
98 | def test_path_to_str_path_object(self): |
99 | """ |
100 | @@ -63,7 +63,7 @@ |
101 | result = path_to_str(Path('test/path')) |
102 | |
103 | # THEN: `path_to_str` should return a string representation of the Path object |
104 | - self.assertEqual(result, os.path.join('test', 'path')) |
105 | + assert result == os.path.join('test', 'path') |
106 | |
107 | def test_str_to_path_type_error(self): |
108 | """ |
109 | @@ -84,4 +84,4 @@ |
110 | result = str_to_path('') |
111 | |
112 | # THEN: `path_to_str` should return None |
113 | - self.assertEqual(result, None) |
114 | + assert result is None |
115 | |
116 | === modified file 'tests/functional/openlp_core/test_app.py' |
117 | --- tests/functional/openlp_core/test_app.py 2017-12-19 19:22:47 +0000 |
118 | +++ tests/functional/openlp_core/test_app.py 2017-12-24 07:19:49 +0000 |
119 | @@ -310,7 +310,7 @@ |
120 | |
121 | # THEN: |
122 | assert result is True, "The method should have returned True." |
123 | - # self.assertFalse(self.openlp.main_window.isMinimized()) |
124 | + # assert self.openlp.main_window.isMinimized() is False |
125 | |
126 | @patch('openlp.core.app.get_version') |
127 | @patch('openlp.core.app.QtWidgets.QMessageBox.question') |
128 | |
129 | === modified file 'tests/functional/openlp_core/ui/test_mainwindow.py' |
130 | --- tests/functional/openlp_core/ui/test_mainwindow.py 2017-12-20 20:38:43 +0000 |
131 | +++ tests/functional/openlp_core/ui/test_mainwindow.py 2017-12-24 07:19:49 +0000 |
132 | @@ -117,8 +117,8 @@ |
133 | # WHEN no changes are made to the service |
134 | |
135 | # THEN the main window's title shoud be the same as the OpenLP string in the UiStrings class |
136 | - self.assertEqual(self.main_window.windowTitle(), UiStrings().OpenLP, |
137 | - 'The main window\'s title should be the same as the OpenLP string in UiStrings class') |
138 | + assert self.main_window.windowTitle() == UiStrings().OpenLP, \ |
139 | + 'The main window\'s title should be the same as the OpenLP string in UiStrings class' |
140 | |
141 | def test_set_service_modifed(self): |
142 | """ |
143 | @@ -204,7 +204,7 @@ |
144 | self.main_window.on_search_shortcut_triggered() |
145 | |
146 | # THEN: The media manager dock is made visible |
147 | - self.assertEqual(0, mocked_media_manager_dock.setVisible.call_count) |
148 | + assert 0 == mocked_media_manager_dock.setVisible.call_count |
149 | mocked_widget.on_focus.assert_called_with() |
150 | |
151 | @patch('openlp.core.ui.mainwindow.FirstTimeForm') |
152 | |
153 | === modified file 'tests/functional/openlp_plugins/alerts/test_manager.py' |
154 | --- tests/functional/openlp_plugins/alerts/test_manager.py 2017-04-24 05:17:55 +0000 |
155 | +++ tests/functional/openlp_plugins/alerts/test_manager.py 2017-12-24 07:19:49 +0000 |
156 | @@ -51,7 +51,7 @@ |
157 | alert_manager.alert_text('') |
158 | |
159 | # THEN: the display should not have been triggered |
160 | - self.assertFalse(alert_manager.display_alert.called, 'The Alert should not have been called') |
161 | + assert alert_manager.display_alert.called is False, 'The Alert should not have been called' |
162 | |
163 | def test_trigger_message_text(self): |
164 | """ |
165 | @@ -65,7 +65,7 @@ |
166 | alert_manager.alert_text(['This is a string']) |
167 | |
168 | # THEN: the display should have been triggered |
169 | - self.assertTrue(alert_manager.display_alert.called, 'The Alert should have been called') |
170 | + assert alert_manager.display_alert.called is True, 'The Alert should have been called' |
171 | |
172 | def test_line_break_message_text(self): |
173 | """ |
174 | @@ -79,5 +79,5 @@ |
175 | alert_manager.alert_text(['This is \n a string']) |
176 | |
177 | # THEN: the display should have been triggered |
178 | - self.assertTrue(alert_manager.display_alert.called, 'The Alert should have been called') |
179 | + assert alert_manager.display_alert.called is True, 'The Alert should have been called' |
180 | alert_manager.display_alert.assert_called_once_with('This is a string') |
181 | |
182 | === modified file 'tests/functional/openlp_plugins/bibles/test_bibleserver.py' |
183 | --- tests/functional/openlp_plugins/bibles/test_bibleserver.py 2017-05-30 18:42:35 +0000 |
184 | +++ tests/functional/openlp_plugins/bibles/test_bibleserver.py 2017-12-24 07:19:49 +0000 |
185 | @@ -75,9 +75,8 @@ |
186 | self.mock_urllib.parse.quote.assert_called_once_with(b'NIV') |
187 | self.mock_get_soup_for_bible_ref.assert_called_once_with( |
188 | 'http://m.bibleserver.com/overlay/selectBook?translation=NIV') |
189 | - self.assertIsNone(result, |
190 | - 'BSExtract.get_books_from_http should return None when get_soup_for_bible_ref returns a ' |
191 | - 'false value') |
192 | + assert result is None, \ |
193 | + 'BSExtract.get_books_from_http should return None when get_soup_for_bible_ref returns a false value' |
194 | |
195 | def test_get_books_from_http_no_content(self): |
196 | """ |
197 | @@ -106,9 +105,8 @@ |
198 | self.mock_soup.find.assert_called_once_with('ul') |
199 | self.mock_log.error.assert_called_once_with('No books found in the Bibleserver response.') |
200 | self.mock_send_error_message.assert_called_once_with('parse') |
201 | - self.assertIsNone(result, |
202 | - 'BSExtract.get_books_from_http should return None when get_soup_for_bible_ref returns a ' |
203 | - 'false value') |
204 | + assert result is None, \ |
205 | + 'BSExtract.get_books_from_http should return None when get_soup_for_bible_ref returns a false value' |
206 | |
207 | def test_get_books_from_http_content(self): |
208 | """ |
209 | @@ -138,6 +136,6 @@ |
210 | self.mock_urllib.parse.quote.assert_called_once_with(b'NIV') |
211 | self.mock_get_soup_for_bible_ref.assert_called_once_with( |
212 | 'http://m.bibleserver.com/overlay/selectBook?translation=NIV') |
213 | - self.assertFalse(self.mock_log.error.called, 'log.error should not have been called') |
214 | - self.assertFalse(self.mock_send_error_message.called, 'send_error_message should not have been called') |
215 | - self.assertEqual(result, ['Genesis', 'Leviticus']) |
216 | + assert self.mock_log.error.called is False, 'log.error should not have been called' |
217 | + assert self.mock_send_error_message.called is False, 'send_error_message should not have been called' |
218 | + assert result == ['Genesis', 'Leviticus'] |
219 | |
220 | === modified file 'tests/functional/openlp_plugins/bibles/test_csvimport.py' |
221 | --- tests/functional/openlp_plugins/bibles/test_csvimport.py 2017-11-06 22:41:36 +0000 |
222 | +++ tests/functional/openlp_plugins/bibles/test_csvimport.py 2017-12-24 07:19:49 +0000 |
223 | @@ -64,9 +64,9 @@ |
224 | CSVBible(mocked_manager, path='.', name='.', books_path=Path('books.csv'), verse_path=Path('verse.csv')) |
225 | |
226 | # THEN: The importer should be an instance of BibleImport |
227 | - self.assertIsInstance(importer, BibleImport) |
228 | - self.assertEqual(importer.books_path, Path('books.csv')) |
229 | - self.assertEqual(importer.verses_path, Path('verse.csv')) |
230 | + assert isinstance(importer, BibleImport) |
231 | + assert importer.books_path == Path('books.csv') |
232 | + assert importer.verses_path == Path('verse.csv') |
233 | |
234 | def test_book_namedtuple(self): |
235 | """ |
236 | @@ -77,10 +77,10 @@ |
237 | result = Book('id', 'testament_id', 'name', 'abbreviation') |
238 | |
239 | # THEN: The attributes should match up with the data we used |
240 | - self.assertEqual(result.id, 'id') |
241 | - self.assertEqual(result.testament_id, 'testament_id') |
242 | - self.assertEqual(result.name, 'name') |
243 | - self.assertEqual(result.abbreviation, 'abbreviation') |
244 | + assert result.id == 'id' |
245 | + assert result.testament_id == 'testament_id' |
246 | + assert result.name == 'name' |
247 | + assert result.abbreviation == 'abbreviation' |
248 | |
249 | def test_verse_namedtuple(self): |
250 | """ |
251 | @@ -91,10 +91,10 @@ |
252 | result = Verse('book_id_name', 'chapter_number', 'number', 'text') |
253 | |
254 | # THEN: The attributes should match up with the data we used |
255 | - self.assertEqual(result.book_id_name, 'book_id_name') |
256 | - self.assertEqual(result.chapter_number, 'chapter_number') |
257 | - self.assertEqual(result.number, 'number') |
258 | - self.assertEqual(result.text, 'text') |
259 | + assert result.book_id_name == 'book_id_name' |
260 | + assert result.chapter_number == 'chapter_number' |
261 | + assert result.number == 'number' |
262 | + assert result.text == 'text' |
263 | |
264 | def test_get_book_name_id(self): |
265 | """ |
266 | @@ -109,7 +109,7 @@ |
267 | actual_result = CSVBible.get_book_name(name, books) |
268 | |
269 | # THEN: get_book_name() should return the book name associated with that id from the books dictionary |
270 | - self.assertEqual(actual_result, expected_result) |
271 | + assert actual_result == expected_result |
272 | |
273 | def test_get_book_name(self): |
274 | """ |
275 | @@ -124,7 +124,7 @@ |
276 | actual_result = CSVBible.get_book_name(name, books) |
277 | |
278 | # THEN: get_book_name() should return the input |
279 | - self.assertEqual(actual_result, expected_result) |
280 | + assert actual_result == expected_result |
281 | |
282 | def test_parse_csv_file(self): |
283 | """ |
284 | @@ -144,8 +144,8 @@ |
285 | result = CSVBible.parse_csv_file(Path('file.csv'), TestTuple) |
286 | |
287 | # THEN: A list of TestTuple instances with the parsed data should be returned |
288 | - self.assertEqual(result, [TestTuple('1', 'Line 1', 'Data 1'), TestTuple('2', 'Line 2', 'Data 2'), |
289 | - TestTuple('3', 'Line 3', 'Data 3')]) |
290 | + assert result == [TestTuple('1', 'Line 1', 'Data 1'), TestTuple('2', 'Line 2', 'Data 2'), |
291 | + TestTuple('3', 'Line 3', 'Data 3')] |
292 | mocked_open.assert_called_once_with('r', encoding='utf-8', newline='') |
293 | mocked_reader.assert_called_once_with(ANY, delimiter=',', quotechar='"') |
294 | |
295 | @@ -162,7 +162,7 @@ |
296 | # THEN: A ValidationError should be raised |
297 | with self.assertRaises(ValidationError) as context: |
298 | CSVBible.parse_csv_file(Path('file.csv'), None) |
299 | - self.assertEqual(context.exception.msg, 'Parsing "file.csv" failed') |
300 | + assert context.exception.msg == 'Parsing "file.csv" failed' |
301 | |
302 | def test_parse_csv_file_csverror(self): |
303 | """ |
304 | @@ -178,7 +178,7 @@ |
305 | # THEN: A ValidationError should be raised |
306 | with self.assertRaises(ValidationError) as context: |
307 | CSVBible.parse_csv_file(Path('file.csv'), None) |
308 | - self.assertEqual(context.exception.msg, 'Parsing "file.csv" failed') |
309 | + assert context.exception.msg == 'Parsing "file.csv" failed' |
310 | |
311 | def test_process_books_stopped_import(self): |
312 | """ |
313 | @@ -197,8 +197,8 @@ |
314 | result = importer.process_books(['Book 1']) |
315 | |
316 | # THEN: increment_progress_bar should not be called and the return value should be an empty dictionary |
317 | - self.assertFalse(importer.wizard.increment_progress_bar.called) |
318 | - self.assertEqual(result, {}) |
319 | + assert importer.wizard.increment_progress_bar.called is False |
320 | + assert result == {} |
321 | |
322 | def test_process_books(self): |
323 | """ |
324 | @@ -222,9 +222,9 @@ |
325 | |
326 | # THEN: translate and find_and_create_book should have been called with both book names. |
327 | # The returned data should be a dictionary with both song's id and names. |
328 | - self.assertEqual(importer.find_and_create_book.mock_calls, |
329 | - [call('1. Mosebog', 2, 10), call('2. Mosebog', 2, 10)]) |
330 | - self.assertDictEqual(result, {1: '1. Mosebog', 2: '2. Mosebog'}) |
331 | + assert importer.find_and_create_book.mock_calls == \ |
332 | + [call('1. Mosebog', 2, 10), call('2. Mosebog', 2, 10)] |
333 | + assert result == {1: '1. Mosebog', 2: '2. Mosebog'} |
334 | |
335 | def test_process_verses_stopped_import(self): |
336 | """ |
337 | @@ -244,8 +244,8 @@ |
338 | result = importer.process_verses(['Dummy Verse'], []) |
339 | |
340 | # THEN: get_book_name should not be called and the return value should be None |
341 | - self.assertFalse(importer.get_book_name.called) |
342 | - self.assertIsNone(result) |
343 | + assert importer.get_book_name.called is False |
344 | + assert result is None |
345 | |
346 | def test_process_verses_successful(self): |
347 | """ |
348 | @@ -272,13 +272,13 @@ |
349 | importer.process_verses(verses, books) |
350 | |
351 | # THEN: create_verse is called with the test data |
352 | - self.assertEqual(importer.get_book_name.mock_calls, [call(1, books), call(1, books)]) |
353 | + assert importer.get_book_name.mock_calls == [call(1, books), call(1, books)] |
354 | importer.get_book.assert_called_once_with('1. Mosebog') |
355 | - self.assertEqual(importer.session.commit.call_count, 2) |
356 | - self.assertEqual(importer.create_verse.mock_calls, |
357 | - [call('1', 1, 1, 'I Begyndelsen skabte Gud Himmelen og Jorden.'), |
358 | - call('1', 1, 2, 'Og Jorden var øde og tom, og der var Mørke over Verdensdybet. ' |
359 | - 'Men Guds Ånd svævede over Vandene.')]) |
360 | + assert importer.session.commit.call_count == 2 |
361 | + assert importer.create_verse.mock_calls == \ |
362 | + [call('1', 1, 1, 'I Begyndelsen skabte Gud Himmelen og Jorden.'), |
363 | + call('1', 1, 2, 'Og Jorden var øde og tom, og der var Mørke over Verdensdybet. ' |
364 | + 'Men Guds Ånd svævede over Vandene.')] |
365 | |
366 | def test_do_import_invalid_language_id(self): |
367 | """ |
368 | @@ -296,7 +296,7 @@ |
369 | |
370 | # THEN: The False should be returned. |
371 | importer.get_language.assert_called_once_with('Bible Name') |
372 | - self.assertFalse(result) |
373 | + assert result is False |
374 | |
375 | def test_do_import_success(self): |
376 | """ |
377 | @@ -320,11 +320,11 @@ |
378 | |
379 | # THEN: parse_csv_file should be called twice, |
380 | # and True should be returned. |
381 | - self.assertEqual(importer.parse_csv_file.mock_calls, |
382 | - [call(Path('books.csv'), Book), call(Path('verses.csv'), Verse)]) |
383 | + assert importer.parse_csv_file.mock_calls == \ |
384 | + [call(Path('books.csv'), Book), call(Path('verses.csv'), Verse)] |
385 | importer.process_books.assert_called_once_with(['Book 1']) |
386 | importer.process_verses.assert_called_once_with(['Verse 1'], ['Book 1']) |
387 | - self.assertTrue(result) |
388 | + assert result is True |
389 | |
390 | def test_file_import(self): |
391 | """ |
392 | @@ -353,7 +353,7 @@ |
393 | importer.do_import() |
394 | |
395 | # THEN: The create_verse() method should have been called with each verse in the file. |
396 | - self.assertTrue(importer.create_verse.called) |
397 | + assert importer.create_verse.called is True |
398 | for verse_tag, verse_text in test_data['verses']: |
399 | importer.create_verse.assert_any_call(importer.get_book().id, 1, verse_tag, verse_text) |
400 | importer.create_book.assert_any_call('1. Mosebog', importer.get_book_ref_id_by_name(), 1) |
401 | |
402 | === modified file 'tests/functional/openlp_plugins/bibles/test_lib.py' |
403 | --- tests/functional/openlp_plugins/bibles/test_lib.py 2017-06-05 02:58:38 +0000 |
404 | +++ tests/functional/openlp_plugins/bibles/test_lib.py 2017-12-24 07:19:49 +0000 |
405 | @@ -59,7 +59,7 @@ |
406 | _ = lib.get_reference_separator(key) |
407 | |
408 | # THEN: get_reference_separator should return the correct separator |
409 | - self.assertEqual(separators[key], value) |
410 | + assert separators[key] == value |
411 | mocked_update_reference_separators.assert_called_once_with() |
412 | |
413 | def test_reference_matched_full(self): |
414 | @@ -116,13 +116,13 @@ |
415 | |
416 | # THEN: A match should be returned, and the book and reference should match the |
417 | # expected result |
418 | - self.assertIsNotNone(match, '{text} should provide a match'.format(text=reference_text)) |
419 | - self.assertEqual(book_result, match.group('book'), |
420 | - '{text} does not provide the expected result for the book group.' |
421 | - .format(text=reference_text)) |
422 | - self.assertEqual(ranges_result, match.group('ranges'), |
423 | - '{text} does not provide the expected result for the ranges group.' |
424 | - .format(text=reference_text)) |
425 | + assert match is not None, '{text} should provide a match'.format(text=reference_text) |
426 | + assert book_result == match.group('book'), \ |
427 | + '{text} does not provide the expected result for the book group.'\ |
428 | + .format(text=reference_text) |
429 | + assert ranges_result == match.group('ranges'), \ |
430 | + '{text} does not provide the expected result for the ranges group.' \ |
431 | + .format(text=reference_text) |
432 | |
433 | def test_reference_matched_range(self): |
434 | """ |
435 | @@ -158,12 +158,12 @@ |
436 | |
437 | # THEN: A match should be returned, and the to/from chapter/verses should match as |
438 | # expected |
439 | - self.assertIsNotNone(match, '{text} should provide a match'.format(text=reference_text)) |
440 | - self.assertEqual(match.group('from_chapter'), from_chapter) |
441 | - self.assertEqual(match.group('from_verse'), from_verse) |
442 | - self.assertEqual(match.group('range_to'), range_to) |
443 | - self.assertEqual(match.group('to_chapter'), to_chapter) |
444 | - self.assertEqual(match.group('to_verse'), to_verse) |
445 | + assert match is not None, '{text} should provide a match'.format(text=reference_text) |
446 | + assert match.group('from_chapter') == from_chapter |
447 | + assert match.group('from_verse') == from_verse |
448 | + assert match.group('range_to') == range_to |
449 | + assert match.group('to_chapter') == to_chapter |
450 | + assert match.group('to_verse') == to_verse |
451 | |
452 | def test_reference_matched_range_separator(self): |
453 | # GIVEN: Some test data which contains different references to parse, with the expected results. |
454 | @@ -199,7 +199,7 @@ |
455 | references = full_reference_match.split(reference_text) |
456 | |
457 | # THEN: The list of references should be as the expected results |
458 | - self.assertEqual(references, ranges) |
459 | + assert references == ranges |
460 | |
461 | def test_search_results_creation(self): |
462 | """ |
463 | @@ -218,10 +218,10 @@ |
464 | search_results = SearchResults(book, chapter, verse_list) |
465 | |
466 | # THEN: It should have a book, a chapter and a verse list |
467 | - self.assertIsNotNone(search_results, 'The search_results object should not be None') |
468 | - self.assertEqual(search_results.book, book, 'The book should be "Genesis"') |
469 | - self.assertEqual(search_results.chapter, chapter, 'The chapter should be 1') |
470 | - self.assertDictEqual(search_results.verse_list, verse_list, 'The verse lists should be identical') |
471 | + assert search_results is not None, 'The search_results object should not be None' |
472 | + assert search_results.book == book, 'The book should be "Genesis"' |
473 | + assert search_results.chapter == chapter, 'The chapter should be 1' |
474 | + assert search_results.verse_list == verse_list, 'The verse lists should be identical' |
475 | |
476 | def test_search_results_has_verse_list(self): |
477 | """ |
478 | @@ -234,7 +234,7 @@ |
479 | has_verse_list = search_results.has_verse_list() |
480 | |
481 | # THEN: It should be True |
482 | - self.assertTrue(has_verse_list, 'The SearchResults object should have a verse list') |
483 | + assert has_verse_list is True, 'The SearchResults object should have a verse list' |
484 | |
485 | def test_search_results_has_no_verse_list(self): |
486 | """ |
487 | @@ -247,4 +247,4 @@ |
488 | has_verse_list = search_results.has_verse_list() |
489 | |
490 | # THEN: It should be False |
491 | - self.assertFalse(has_verse_list, 'The SearchResults object should have a verse list') |
492 | + assert has_verse_list is False, 'The SearchResults object should have a verse list' |
493 | |
494 | === modified file 'tests/functional/openlp_plugins/bibles/test_manager.py' |
495 | --- tests/functional/openlp_plugins/bibles/test_manager.py 2017-08-25 20:03:25 +0000 |
496 | +++ tests/functional/openlp_plugins/bibles/test_manager.py 2017-12-24 07:19:49 +0000 |
497 | @@ -63,7 +63,7 @@ |
498 | |
499 | # THEN: The session should have been closed and set to None, the bible should be deleted, and the result of |
500 | # the deletion returned. |
501 | - self.assertTrue(result) |
502 | + assert result is True |
503 | mocked_close_all.assert_called_once_with() |
504 | - self.assertIsNone(mocked_bible.session) |
505 | + assert mocked_bible.session is None |
506 | mocked_delete_file.assert_called_once_with(Path('bibles', 'KJV.sqlite')) |
507 | |
508 | === modified file 'tests/functional/openlp_plugins/bibles/test_mediaitem.py' |
509 | --- tests/functional/openlp_plugins/bibles/test_mediaitem.py 2017-10-07 07:05:07 +0000 |
510 | +++ tests/functional/openlp_plugins/bibles/test_mediaitem.py 2017-12-24 07:19:49 +0000 |
511 | @@ -53,9 +53,9 @@ |
512 | |
513 | # THEN: The expected result should be returned |
514 | if expected_result is None: |
515 | - self.assertIsNone(result, expected_result) |
516 | + assert result is None, expected_result |
517 | else: |
518 | - self.assertEqual(result.regs, expected_result) |
519 | + assert result.regs == expected_result |
520 | |
521 | def test_get_reference_separators(self): |
522 | """ |
523 | @@ -69,7 +69,7 @@ |
524 | |
525 | # THEN: The result should contain the 'verse', 'range', 'list' keys and get_reference_separator should have |
526 | # been called with the expected values. |
527 | - self.assertTrue(all(key in result for key in ('verse', 'range', 'list'))) |
528 | + assert all(key in result for key in ('verse', 'range', 'list')) is True |
529 | mocked_get_reference_separator.assert_has_calls( |
530 | [call('sep_v_display'), call('sep_r_display'), call('sep_l_display')]) |
531 | |
532 | @@ -80,9 +80,9 @@ |
533 | # GIVEN: The BibleSearch class |
534 | # WHEN: Testing its attributes |
535 | # THEN: The BibleSearch class should have the following enumrations |
536 | - self.assertTrue(hasattr(BibleSearch, 'Combined')) |
537 | - self.assertTrue(hasattr(BibleSearch, 'Reference')) |
538 | - self.assertTrue(hasattr(BibleSearch, 'Text')) |
539 | + assert hasattr(BibleSearch, 'Combined') |
540 | + assert hasattr(BibleSearch, 'Reference') |
541 | + assert hasattr(BibleSearch, 'Text') |
542 | |
543 | def test_bible_media_item_subclass(self): |
544 | """ |
545 | @@ -91,7 +91,7 @@ |
546 | # GIVEN: The :class:`BibleMediaItem` |
547 | # WHEN: Checking if it is a subclass of MediaManagerItem |
548 | # THEN: BibleMediaItem should be a subclass of MediaManagerItem |
549 | - self.assertTrue(issubclass(BibleMediaItem, MediaManagerItem)) |
550 | + assert issubclass(BibleMediaItem, MediaManagerItem) |
551 | |
552 | def test_bible_media_item_signals(self): |
553 | """ |
554 | @@ -99,10 +99,10 @@ |
555 | """ |
556 | # GIVEN: The :class:`BibleMediaItem` |
557 | # THEN: The :class:`BibleMediaItem` should contain the following pyqtSignal's |
558 | - self.assertTrue(hasattr(BibleMediaItem, 'bibles_go_live')) |
559 | - self.assertTrue(hasattr(BibleMediaItem, 'bibles_add_to_service')) |
560 | - self.assertTrue(isinstance(BibleMediaItem.bibles_go_live, QtCore.pyqtSignal)) |
561 | - self.assertTrue(isinstance(BibleMediaItem.bibles_add_to_service, QtCore.pyqtSignal)) |
562 | + assert hasattr(BibleMediaItem, 'bibles_go_live') |
563 | + assert hasattr(BibleMediaItem, 'bibles_add_to_service') |
564 | + assert isinstance(BibleMediaItem.bibles_go_live, QtCore.pyqtSignal) |
565 | + assert isinstance(BibleMediaItem.bibles_add_to_service, QtCore.pyqtSignal) |
566 | |
567 | |
568 | class TestMediaItem(TestCase, TestMixin): |
569 | @@ -166,7 +166,7 @@ |
570 | # GIVEN: An instance of :class:`BibleMediaItem` |
571 | # WEHN: Checking its class |
572 | # THEN: It should be a subclass of :class:`MediaManagerItem` |
573 | - self.assertTrue(isinstance(self.media_item, MediaManagerItem)) |
574 | + assert isinstance(self.media_item, MediaManagerItem) |
575 | |
576 | def test_steup_item(self): |
577 | """ |
578 | @@ -193,11 +193,11 @@ |
579 | self.media_item.required_icons() |
580 | |
581 | # THEN: The correct icons should be set |
582 | - self.assertTrue(self.media_item.has_import_icon, 'Check that the icon is as True.') |
583 | - self.assertFalse(self.media_item.has_new_icon, 'Check that the icon is called as False.') |
584 | - self.assertTrue(self.media_item.has_edit_icon, 'Check that the icon is called as True.') |
585 | - self.assertTrue(self.media_item.has_delete_icon, 'Check that the icon is called as True.') |
586 | - self.assertFalse(self.media_item.add_to_service_item, 'Check that the icon is called as False') |
587 | + assert self.media_item.has_import_icon is True, 'Check that the icon is as True.' |
588 | + assert self.media_item.has_new_icon is False, 'Check that the icon is called as False.' |
589 | + assert self.media_item.has_edit_icon is True, 'Check that the icon is called as True.' |
590 | + assert self.media_item.has_delete_icon is True, 'Check that the icon is called as True.' |
591 | + assert self.media_item.add_to_service_item is False, 'Check that the icon is called as False' |
592 | |
593 | def test_on_focus_search_tab_visible(self): |
594 | """ |
595 | @@ -305,8 +305,8 @@ |
596 | self.media_item.initialise() |
597 | |
598 | # THEN: The search_edit search types should have been set. |
599 | - self.assertTrue(self.media_item.search_edit.set_search_types.called) |
600 | - self.assertFalse(self.media_item.search_edit.set_current_search_type.called) |
601 | + assert self.media_item.search_edit.set_search_types.called is True |
602 | + assert self.media_item.search_edit.set_current_search_type.called is False |
603 | |
604 | def test_initalise_reset_search_type(self): |
605 | """ |
606 | @@ -323,7 +323,7 @@ |
607 | |
608 | # THEN: The search_edit search types should have been set and that the current search type should be set to |
609 | # 'Combined' |
610 | - self.assertTrue(self.media_item.search_edit.set_search_types.called) |
611 | + assert self.media_item.search_edit.set_search_types.called is True |
612 | self.media_item.search_edit.set_current_search_type.assert_called_once_with(BibleSearch.Combined) |
613 | |
614 | def test_populate_bible_combo_boxes(self): |
615 | @@ -373,7 +373,7 @@ |
616 | result = self.media_item.get_common_books(self.mocked_bible_1) |
617 | |
618 | # THEN: The book of the bible should be returned |
619 | - self.assertEqual(result, self.book_list_1) |
620 | + assert result == self.book_list_1 |
621 | |
622 | def test_get_common_books_second_book(self): |
623 | """ |
624 | @@ -384,7 +384,7 @@ |
625 | result = self.media_item.get_common_books(self.mocked_bible_1, self.mocked_bible_2) |
626 | |
627 | # THEN: Only the books contained in both bibles should be returned |
628 | - self.assertEqual(result, [self.mocked_book_2, self.mocked_book_3]) |
629 | + assert result == [self.mocked_book_2, self.mocked_book_3] |
630 | |
631 | def test_initialise_advanced_bible_no_bible(self): |
632 | """ |
633 | @@ -399,7 +399,7 @@ |
634 | result = self.media_item.initialise_advanced_bible() |
635 | |
636 | # THEN: initialise_advanced_bible should return with put calling get_common_books |
637 | - self.assertIsNone(result) |
638 | + assert result is None |
639 | mocked_get_common_books.assert_not_called() |
640 | |
641 | def test_initialise_advanced_bible_add_books_with_last_id_found(self): |
642 | @@ -515,8 +515,8 @@ |
643 | self.media_item.on_import_click() |
644 | |
645 | # THEN: BibleImport wizard should have been instianted and reload_bibles should not have been called |
646 | - self.assertTrue(mocked_bible_import_form.called) |
647 | - self.assertFalse(mocked_reload_bibles.called) |
648 | + assert mocked_bible_import_form.called is True |
649 | + assert mocked_reload_bibles.called is False |
650 | |
651 | def test_on_import_click_wizard_not_canceled(self): |
652 | """ |
653 | @@ -532,8 +532,8 @@ |
654 | self.media_item.on_import_click() |
655 | |
656 | # THEN: BibleImport wizard should have been instianted and reload_bibles should not have been called |
657 | - self.assertFalse(mocked_import_wizard.called) |
658 | - self.assertTrue(mocked_reload_bibles.called) |
659 | + assert mocked_import_wizard.called is False |
660 | + assert mocked_reload_bibles.called is True |
661 | |
662 | def test_on_edit_click_no_bible(self): |
663 | """ |
664 | @@ -547,7 +547,7 @@ |
665 | self.media_item.on_edit_click() |
666 | |
667 | # THEN: EditBibleForm should not have been instianted |
668 | - self.assertFalse(mocked_edit_bible_form.called) |
669 | + assert mocked_edit_bible_form.called is False |
670 | |
671 | def test_on_edit_click_user_cancel_edit_form(self): |
672 | """ |
673 | @@ -565,8 +565,8 @@ |
674 | self.media_item.on_edit_click() |
675 | |
676 | # THEN: EditBibleForm should have been been instianted but reload_bibles should not have been called |
677 | - self.assertTrue(mocked_edit_bible_form.called) |
678 | - self.assertFalse(mocked_reload_bibles.called) |
679 | + assert mocked_edit_bible_form.called is True |
680 | + assert mocked_reload_bibles.called is False |
681 | |
682 | def test_on_edit_click_user_accepts_edit_form(self): |
683 | """ |
684 | @@ -585,8 +585,8 @@ |
685 | self.media_item.on_edit_click() |
686 | |
687 | # THEN: EditBibleForm should have been been instianted and reload_bibles should have been called |
688 | - self.assertTrue(mocked_edit_bible_form.called) |
689 | - self.assertTrue(mocked_reload_bibles.called) |
690 | + assert mocked_edit_bible_form.called is True |
691 | + assert mocked_reload_bibles.called is True |
692 | |
693 | def test_on_delete_click_no_bible(self): |
694 | """ |
695 | @@ -600,7 +600,7 @@ |
696 | self.media_item.on_delete_click() |
697 | |
698 | # THEN: QMessageBox.question should not have been called |
699 | - self.assertFalse(mocked_qmessage_box.question.called) |
700 | + assert mocked_qmessage_box.question.called is False |
701 | |
702 | def test_on_delete_click_response_no(self): |
703 | """ |
704 | @@ -615,8 +615,8 @@ |
705 | self.media_item.on_delete_click() |
706 | |
707 | # THEN: QMessageBox.question should have been called, but the delete_bible should not have been called |
708 | - self.assertTrue(mocked_qmessage_box.called) |
709 | - self.assertFalse(self.mocked_plugin.manager.delete_bible.called) |
710 | + assert mocked_qmessage_box.called is True |
711 | + assert self.mocked_plugin.manager.delete_bible.called is False |
712 | |
713 | def test_on_delete_click_response_yes(self): |
714 | """ |
715 | @@ -632,8 +632,8 @@ |
716 | self.media_item.on_delete_click() |
717 | |
718 | # THEN: QMessageBox.question should and delete_bible should not have been called |
719 | - self.assertTrue(mocked_qmessage_box.called) |
720 | - self.assertTrue(self.mocked_plugin.manager.delete_bible.called) |
721 | + assert mocked_qmessage_box.called is True |
722 | + assert self.mocked_plugin.manager.delete_bible.called is True |
723 | |
724 | def test_on_search_tab_bar_current_changed_search_tab_selected(self): |
725 | """ |
726 | @@ -711,8 +711,8 @@ |
727 | self.media_item.on_clear_button_clicked() |
728 | |
729 | # THEN: The list_view and the search_edit should be cleared |
730 | - self.assertEqual(self.media_item.current_results, []) |
731 | - self.assertEqual(self.media_item.list_view.takeItem.call_count, 2) |
732 | + assert self.media_item.current_results == [] |
733 | + assert self.media_item.list_view.takeItem.call_count == 2 |
734 | self.media_item.list_view.row.assert_has_calls([call('Some'), call('Results')]) |
735 | |
736 | def test_on_save_results_button_clicked(self): |
737 | @@ -733,7 +733,7 @@ |
738 | |
739 | # THEN: The selected results in the list_view should be added to the 'saved_results' list. And the saved_tab |
740 | # total should be updated. |
741 | - self.assertEqual(self.media_item.saved_results, ['R1', 'R2', 'R3']) |
742 | + assert self.media_item.saved_results == ['R1', 'R2', 'R3'] |
743 | mocked_on_results_view_tab_total_update.assert_called_once_with(ResultsTab.Saved) |
744 | |
745 | def test_on_style_combo_box_changed(self): |
746 | @@ -746,8 +746,8 @@ |
747 | # WHEN: Calling on_style_combo_box_index_changed |
748 | self.media_item.on_style_combo_box_index_changed(2) |
749 | |
750 | - # THEN: The layput_style settimg should have been set |
751 | - self.assertEqual(self.media_item.settings.layout_style, 2) |
752 | + # THEN: The layout_style setting should have been set |
753 | + assert self.media_item.settings.layout_style == 2 |
754 | self.media_item.settings.layout_style_combo_box.setCurrentIndex.assert_called_once_with(2) |
755 | self.mocked_settings_instance.setValue.assert_called_once_with('bibles/verse layout style', 2) |
756 | |
757 | @@ -763,9 +763,9 @@ |
758 | # WHEN: Calling on_version_combo_box_index_changed |
759 | self.media_item.on_version_combo_box_index_changed() |
760 | |
761 | - # THEN: The vesion should be saved to settings and the 'select tab' should be initialised |
762 | - self.assertFalse(self.mocked_settings_instance.setValue.called) |
763 | - self.assertTrue(self.media_item.initialise_advanced_bible.called) |
764 | + # THEN: The version should be saved to settings and the 'select tab' should be initialised |
765 | + assert self.mocked_settings_instance.setValue.called is False |
766 | + assert self.media_item.initialise_advanced_bible.called is True |
767 | |
768 | def test_on_version_combo_box_index_changed_bible_selected(self): |
769 | """ |
770 | @@ -781,9 +781,9 @@ |
771 | # WHEN: Calling on_version_combo_box_index_changed |
772 | self.media_item.on_version_combo_box_index_changed() |
773 | |
774 | - # THEN: The vesion should be saved to settings and the 'select tab' should be initialised |
775 | + # THEN: The version should be saved to settings and the 'select tab' should be initialised |
776 | self.mocked_settings_instance.setValue.assert_called_once_with('bibles/primary bible', 'ABC') |
777 | - self.assertTrue(self.media_item.initialise_advanced_bible.called) |
778 | + assert self.media_item.initialise_advanced_bible.called is True |
779 | |
780 | def test_on_second_combo_box_index_changed_mode_not_changed(self): |
781 | """ |
782 | @@ -798,15 +798,15 @@ |
783 | patch('openlp.plugins.bibles.lib.mediaitem.critical_error_message_box') \ |
784 | as mocked_critical_error_message_box: |
785 | |
786 | - # WHEN: The previously selected bible is one bible and the new selection is annother bible |
787 | + # WHEN: The previously selected bible is one bible and the new selection is another bible |
788 | self.media_item.second_bible = self.mocked_bible_1 |
789 | self.media_item.second_combo_box = MagicMock(**{'currentData.return_value': self.mocked_bible_2}) |
790 | self.media_item.on_second_combo_box_index_changed(5) |
791 | |
792 | # THEN: The new bible should now be the current bible |
793 | - self.assertFalse(mocked_critical_error_message_box.called) |
794 | + assert mocked_critical_error_message_box.called is False |
795 | self.media_item.style_combo_box.setEnabled.assert_called_once_with(False) |
796 | - self.assertEqual(self.media_item.second_bible, self.mocked_bible_2) |
797 | + assert self.media_item.second_bible == self.mocked_bible_2 |
798 | |
799 | def test_on_second_combo_box_index_changed_single_to_dual_user_abort(self): |
800 | """ |
801 | @@ -828,11 +828,11 @@ |
802 | self.media_item.saved_results = ['saved_results'] |
803 | self.media_item.on_second_combo_box_index_changed(5) |
804 | |
805 | - # THEN: The list_view should be cleared and the currently selected bible should not be channged |
806 | - self.assertTrue(mocked_critical_error_message_box.called) |
807 | - self.assertTrue(self.media_item.second_combo_box.setCurrentIndex.called) |
808 | - self.assertFalse(self.media_item.style_combo_box.setEnabled.called) |
809 | - self.assertEqual(self.media_item.second_bible, None) |
810 | + # THEN: The list_view should be cleared and the currently selected bible should not be changed |
811 | + assert mocked_critical_error_message_box.called is True |
812 | + assert self.media_item.second_combo_box.setCurrentIndex.called is True |
813 | + assert self.media_item.style_combo_box.setEnabled.called is False |
814 | + assert self.media_item.second_bible is None |
815 | |
816 | def test_on_second_combo_box_index_changed_single_to_dual(self): |
817 | """ |
818 | @@ -857,10 +857,10 @@ |
819 | self.media_item.on_second_combo_box_index_changed(5) |
820 | |
821 | # THEN: The selected bible should be set as the current bible |
822 | - self.assertTrue(mocked_critical_error_message_box.called) |
823 | + assert mocked_critical_error_message_box.called is True |
824 | self.media_item.style_combo_box.setEnabled.assert_called_once_with(False) |
825 | - self.assertTrue(mocked_initialise_advanced_bible.called) |
826 | - self.assertEqual(self.media_item.second_bible, self.mocked_bible_1) |
827 | + assert mocked_initialise_advanced_bible.called is True |
828 | + assert self.media_item.second_bible == self.mocked_bible_1 |
829 | |
830 | def test_on_second_combo_box_index_changed_dual_to_single(self): |
831 | """ |
832 | @@ -884,10 +884,10 @@ |
833 | self.media_item.on_second_combo_box_index_changed(0) |
834 | |
835 | # THEN: The selected bible should be set as the current bible |
836 | - self.assertTrue(mocked_critical_error_message_box.called) |
837 | + assert mocked_critical_error_message_box.called is True |
838 | self.media_item.style_combo_box.setEnabled.assert_called_once_with(True) |
839 | - self.assertFalse(mocked_initialise_advanced_bible.called) |
840 | - self.assertEqual(self.media_item.second_bible, None) |
841 | + assert mocked_initialise_advanced_bible.called is False |
842 | + assert self.media_item.second_bible is None |
843 | |
844 | def test_on_advanced_book_combo_box(self): |
845 | """ |
846 | @@ -907,7 +907,7 @@ |
847 | # THEN: The user should be informed that the bible cannot be used and the search button should be disabled |
848 | self.mocked_plugin.manager.get_book_by_id.assert_called_once_with('Bible 1', 2) |
849 | self.media_item.search_button.setEnabled.assert_called_once_with(False) |
850 | - self.assertTrue(mocked_critical_error_message_box.called) |
851 | + assert mocked_critical_error_message_box.called is True |
852 | |
853 | def test_on_advanced_book_combo_box_set_up_comboboxes(self): |
854 | """ |
855 | @@ -930,7 +930,7 @@ |
856 | # THEN: The verse selection combobox's should be set up |
857 | self.mocked_plugin.manager.get_book_by_id.assert_called_once_with('Bible 1', 2) |
858 | self.media_item.search_button.setEnabled.assert_called_once_with(True) |
859 | - self.assertEqual(mocked_adjust_combo_box.call_count, 4) |
860 | + assert mocked_adjust_combo_box.call_count == 4 |
861 | |
862 | def test_on_from_chapter_activated_invalid_to_chapter(self): |
863 | """ |
864 | @@ -951,9 +951,9 @@ |
865 | self.media_item.on_from_chapter_activated() |
866 | |
867 | # THEN: The to_verse and to_chapter comboboxes should be updated appropriately |
868 | - self.assertEqual(mocked_adjust_combo_box.call_args_list, [ |
869 | + assert mocked_adjust_combo_box.call_args_list == [ |
870 | call(1, 20, self.media_item.from_verse), call(1, 20, self.media_item.to_verse, False), |
871 | - call(10, 25, self.media_item.to_chapter, False)]) |
872 | + call(10, 25, self.media_item.to_chapter, False)] |
873 | |
874 | def test_on_from_chapter_activated_same_chapter(self): |
875 | """ |
876 | @@ -974,9 +974,9 @@ |
877 | self.media_item.on_from_chapter_activated() |
878 | |
879 | # THEN: The to_verse and to_chapter comboboxes should be updated appropriately |
880 | - self.assertEqual(mocked_adjust_combo_box.call_args_list, [ |
881 | + assert mocked_adjust_combo_box.call_args_list == [ |
882 | call(1, 20, self.media_item.from_verse), call(1, 20, self.media_item.to_verse, True), |
883 | - call(5, 25, self.media_item.to_chapter, False)]) |
884 | + call(5, 25, self.media_item.to_chapter, False)] |
885 | |
886 | def test_on_from_chapter_activated_lower_chapter(self): |
887 | """ |
888 | @@ -996,8 +996,8 @@ |
889 | self.media_item.on_from_chapter_activated() |
890 | |
891 | # THEN: The to_verse and to_chapter comboboxes should be updated appropriately |
892 | - self.assertEqual(mocked_adjust_combo_box.call_args_list, [ |
893 | - call(1, 20, self.media_item.from_verse), call(5, 25, self.media_item.to_chapter, True)]) |
894 | + assert mocked_adjust_combo_box.call_args_list == [ |
895 | + call(1, 20, self.media_item.from_verse), call(5, 25, self.media_item.to_chapter, True)] |
896 | |
897 | def test_on_from_verse(self): |
898 | """ |
899 | @@ -1012,7 +1012,7 @@ |
900 | self.media_item.on_from_verse() |
901 | |
902 | # THEN: select_book_combo_box.currentData should nto be called |
903 | - self.assertFalse(self.media_item.select_book_combo_box.currentData.called) |
904 | + assert self.media_item.select_book_combo_box.currentData.called is False |
905 | |
906 | def test_on_from_verse_equal(self): |
907 | """ |
908 | @@ -1107,8 +1107,8 @@ |
909 | |
910 | # THEN: The combo_box should be cleared, and new items added |
911 | mocked_combo_box.clear.assert_called_once_with() |
912 | - self.assertEqual(mocked_combo_box.addItem.call_args_list, |
913 | - [call('10', 10), call('11', 11), call('12', 12), call('13', 13)]) |
914 | + assert mocked_combo_box.addItem.call_args_list == \ |
915 | + [call('10', 10), call('11', 11), call('12', 12), call('13', 13)] |
916 | |
917 | def test_adjust_combo_box_restore_found(self): |
918 | """ |
919 | @@ -1123,8 +1123,8 @@ |
920 | # THEN: The combo_box should be cleared, and new items added. Finally the previously selected item should be |
921 | # reselected |
922 | mocked_combo_box.clear.assert_called_once_with() |
923 | - self.assertEqual(mocked_combo_box.addItem.call_args_list, |
924 | - [call('10', 10), call('11', 11), call('12', 12), call('13', 13)]) |
925 | + assert mocked_combo_box.addItem.call_args_list == \ |
926 | + [call('10', 10), call('11', 11), call('12', 12), call('13', 13)] |
927 | mocked_combo_box.setCurrentIndex.assert_called_once_with(2) |
928 | |
929 | def test_adjust_combo_box_restore_not_found(self): |
930 | @@ -1140,8 +1140,8 @@ |
931 | |
932 | # THEN: The combo_box should be cleared, and new items added. Finally the first item should be selected |
933 | mocked_combo_box.clear.assert_called_once_with() |
934 | - self.assertEqual(mocked_combo_box.addItem.call_args_list, |
935 | - [call('10', 10), call('11', 11), call('12', 12), call('13', 13)]) |
936 | + assert mocked_combo_box.addItem.call_args_list == \ |
937 | + [call('10', 10), call('11', 11), call('12', 12), call('13', 13)] |
938 | mocked_combo_box.setCurrentIndex.assert_called_once_with(0) |
939 | |
940 | def test_on_search_button_no_bible(self): |
941 | @@ -1154,7 +1154,7 @@ |
942 | self.media_item.on_search_button_clicked() |
943 | |
944 | # THEN: The user should be informed that there are no bibles selected |
945 | - self.assertEqual(self.mocked_main_window.information_message.call_count, 1) |
946 | + assert self.mocked_main_window.information_message.call_count == 1 |
947 | |
948 | def test_on_search_button_search_tab(self): |
949 | """ |
950 | @@ -1207,7 +1207,7 @@ |
951 | self.media_item.select_search() |
952 | |
953 | # THEN: reference_search should only be called once |
954 | - self.assertEqual(self.mocked_plugin.manager.get_verses.call_count, 1) |
955 | + assert self.mocked_plugin.manager.get_verses.call_count == 1 |
956 | mocked_display_results.assert_called_once_with() |
957 | |
958 | def test_select_search_dual_bibles(self): |
959 | @@ -1228,7 +1228,7 @@ |
960 | self.media_item.select_search() |
961 | |
962 | # THEN: reference_search should be called twice |
963 | - self.assertEqual(self.mocked_plugin.manager.get_verses.call_count, 2) |
964 | + assert self.mocked_plugin.manager.get_verses.call_count == 2 |
965 | mocked_display_results.assert_called_once_with() |
966 | |
967 | def test_text_reference_search_single_bible(self): |
968 | @@ -1244,7 +1244,7 @@ |
969 | self.media_item.text_reference_search('Search Text') |
970 | |
971 | # THEN: reference_search should only be called once |
972 | - self.assertEqual(self.mocked_plugin.manager.get_verses.call_count, 1) |
973 | + assert self.mocked_plugin.manager.get_verses.call_count == 1 |
974 | mocked_display_results.assert_called_once_with() |
975 | |
976 | def text_reference_search(self, search_text, search_while_type=False): |
977 | @@ -1272,7 +1272,7 @@ |
978 | self.media_item.text_reference_search('Search Text') |
979 | |
980 | # THEN: reference_search should only be called once |
981 | - self.assertEqual(self.mocked_plugin.manager.get_verses.call_count, 1) |
982 | + assert self.mocked_plugin.manager.get_verses.call_count == 1 |
983 | mocked_display_results.assert_called_once_with() |
984 | |
985 | def test_text_reference_search_dual_bible(self): |
986 | @@ -1288,7 +1288,7 @@ |
987 | self.media_item.text_reference_search('Search Text') |
988 | |
989 | # THEN: reference_search should be called twice |
990 | - self.assertEqual(self.mocked_plugin.manager.get_verses.call_count, 2) |
991 | + assert self.mocked_plugin.manager.get_verses.call_count == 2 |
992 | mocked_display_results.assert_called_once_with() |
993 | |
994 | def test_on_text_search_single_bible(self): |
995 | @@ -1305,7 +1305,7 @@ |
996 | self.media_item.on_text_search('Search Text') |
997 | |
998 | # THEN: The search results should be the same as those returned by plugin.manager.verse_search |
999 | - self.assertEqual(self.media_item.search_results, ['results', 'list']) |
1000 | + assert self.media_item.search_results == ['results', 'list'] |
1001 | mocked_display_results.assert_called_once_with() |
1002 | |
1003 | def test_on_text_search_no_results(self): |
1004 | @@ -1322,7 +1322,7 @@ |
1005 | self.media_item.on_text_search('Search Text') |
1006 | |
1007 | # THEN: The search results should be an empty list |
1008 | - self.assertEqual(self.media_item.search_results, []) |
1009 | + assert self.media_item.search_results == [] |
1010 | mocked_display_results.assert_called_once_with() |
1011 | |
1012 | def test_on_text_search_all_results_in_both_books(self): |
1013 | @@ -1345,10 +1345,10 @@ |
1014 | self.media_item.on_text_search('Search Text') |
1015 | |
1016 | # THEN: The search results for both bibles should be returned |
1017 | - self.assertEqual(self.media_item.search_results, [mocked_verse_1, mocked_verse_2]) |
1018 | - self.assertEqual(self.media_item.second_search_results, [mocked_verse_1a, mocked_verse_2a]) |
1019 | - self.assertFalse(self.mocked_log.debug.called) |
1020 | - self.assertFalse(self.mocked_main_window.information_message.called) |
1021 | + assert self.media_item.search_results == [mocked_verse_1, mocked_verse_2] |
1022 | + assert self.media_item.second_search_results == [mocked_verse_1a, mocked_verse_2a] |
1023 | + assert self.mocked_log.debug.called is False |
1024 | + assert self.mocked_main_window.information_message.called is False |
1025 | mocked_display_results.assert_called_once_with() |
1026 | |
1027 | def test_on_text_search_not_all_results_in_both_books(self): |
1028 | @@ -1372,10 +1372,10 @@ |
1029 | |
1030 | # THEN: The search results included in both bibles should be returned and the user should be notified of |
1031 | # the missing verses |
1032 | - self.assertEqual(self.media_item.search_results, [mocked_verse_1]) |
1033 | - self.assertEqual(self.media_item.second_search_results, [mocked_verse_1a]) |
1034 | - self.assertEqual(self.mocked_log.debug.call_count, 2) |
1035 | - self.assertTrue(self.mocked_main_window.information_message.called) |
1036 | + assert self.media_item.search_results == [mocked_verse_1] |
1037 | + assert self.media_item.second_search_results == [mocked_verse_1a] |
1038 | + assert self.mocked_log.debug.call_count == 2 |
1039 | + assert self.mocked_main_window.information_message.called is True |
1040 | mocked_display_results.assert_called_once_with() |
1041 | |
1042 | def test_on_search_edit_text_changed_search_while_typing_disabled(self): |
1043 | @@ -1391,7 +1391,7 @@ |
1044 | self.media_item.on_search_edit_text_changed() |
1045 | |
1046 | # THEN: The method should not have checked if the timer is active |
1047 | - self.assertFalse(self.media_item.search_timer.isActive.called) |
1048 | + assert self.media_item.search_timer.isActive.called is False |
1049 | |
1050 | def test_on_search_edit_text_changed_search_while_typing_enabled(self): |
1051 | """ |
1052 | @@ -1422,7 +1422,7 @@ |
1053 | self.media_item.on_search_timer_timeout() |
1054 | |
1055 | # THEN: The search_status should be set to SearchAsYouType and text_search should have been called |
1056 | - self.assertEqual(self.media_item.search_status, SearchStatus.SearchAsYouType) |
1057 | + assert self.media_item.search_status == SearchStatus.SearchAsYouType |
1058 | mocked_text_search.assert_called_once_with() |
1059 | |
1060 | def test_display_results_no_results(self): |
1061 | @@ -1441,7 +1441,7 @@ |
1062 | self.media_item.display_results() |
1063 | |
1064 | # THEN: No items should be added to the list |
1065 | - self.assertFalse(self.media_item.list_view.addItem.called) |
1066 | + assert self.media_item.list_view.addItem.called is False |
1067 | |
1068 | def test_display_results_results(self): |
1069 | """ |
1070 | |
1071 | === modified file 'tests/functional/openlp_plugins/bibles/test_opensongimport.py' |
1072 | --- tests/functional/openlp_plugins/bibles/test_opensongimport.py 2017-11-06 22:41:36 +0000 |
1073 | +++ tests/functional/openlp_plugins/bibles/test_opensongimport.py 2017-12-24 07:19:49 +0000 |
1074 | @@ -68,7 +68,7 @@ |
1075 | importer = OpenSongBible(mocked_manager, path='.', name='.', file_path=None) |
1076 | |
1077 | # THEN: The importer should be an instance of BibleDB |
1078 | - self.assertIsInstance(importer, BibleImport) |
1079 | + assert isinstance(importer, BibleImport) |
1080 | |
1081 | def test_get_text_no_text(self): |
1082 | """ |
1083 | @@ -81,7 +81,7 @@ |
1084 | result = get_text(test_data) |
1085 | |
1086 | # THEN: A blank string should be returned |
1087 | - self.assertEqual(result, '') |
1088 | + assert result == '' |
1089 | |
1090 | def test_get_text_text(self): |
1091 | """ |
1092 | @@ -98,7 +98,7 @@ |
1093 | result = get_text(test_data) |
1094 | |
1095 | # THEN: The text returned should be as expected |
1096 | - self.assertEqual(result, 'Element text sub_text_tail text sub_text_tail tail sub_text text sub_tail tail') |
1097 | + assert result == 'Element text sub_text_tail text sub_text_tail tail sub_text text sub_tail tail' |
1098 | |
1099 | def test_parse_chapter_number(self): |
1100 | """ |
1101 | @@ -109,7 +109,7 @@ |
1102 | result = parse_chapter_number('10', 0) |
1103 | |
1104 | # THEN: The 10 should be returned as an Int |
1105 | - self.assertEqual(result, 10) |
1106 | + assert result == 10 |
1107 | |
1108 | def test_parse_chapter_number_empty_attribute(self): |
1109 | """ |
1110 | @@ -120,7 +120,7 @@ |
1111 | result = parse_chapter_number('', 12) |
1112 | |
1113 | # THEN: parse_chapter_number should increment the previous verse number |
1114 | - self.assertEqual(result, 13) |
1115 | + assert result == 13 |
1116 | |
1117 | def test_parse_verse_number_valid_verse_no(self): |
1118 | """ |
1119 | @@ -133,7 +133,7 @@ |
1120 | result = importer.parse_verse_number('15', 0) |
1121 | |
1122 | # THEN: parse_verse_number should return the verse number |
1123 | - self.assertEqual(result, 15) |
1124 | + assert result == 15 |
1125 | |
1126 | def test_parse_verse_number_verse_range(self): |
1127 | """ |
1128 | @@ -146,7 +146,7 @@ |
1129 | result = importer.parse_verse_number('24-26', 0) |
1130 | |
1131 | # THEN: parse_verse_number should return the first verse number in the range |
1132 | - self.assertEqual(result, 24) |
1133 | + assert result == 24 |
1134 | |
1135 | def test_parse_verse_number_invalid_verse_no(self): |
1136 | """ |
1137 | @@ -159,7 +159,7 @@ |
1138 | result = importer.parse_verse_number('invalid', 41) |
1139 | |
1140 | # THEN: parse_verse_number should increment the previous verse number |
1141 | - self.assertEqual(result, 42) |
1142 | + assert result == 42 |
1143 | |
1144 | def test_parse_verse_number_empty_attribute(self): |
1145 | """ |
1146 | @@ -171,7 +171,7 @@ |
1147 | result = importer.parse_verse_number('', 14) |
1148 | |
1149 | # THEN: parse_verse_number should increment the previous verse number |
1150 | - self.assertEqual(result, 15) |
1151 | + assert result == 15 |
1152 | |
1153 | def test_parse_verse_number_invalid_type(self): |
1154 | """ |
1155 | @@ -187,7 +187,7 @@ |
1156 | # THEN: parse_verse_number should log the verse number it was called with increment the previous verse |
1157 | # number |
1158 | mocked_log_warning.assert_called_once_with('Illegal verse number: (1, 2, 3)') |
1159 | - self.assertEqual(result, 13) |
1160 | + assert result == 13 |
1161 | |
1162 | def test_process_books_stop_import(self): |
1163 | """ |
1164 | @@ -201,7 +201,7 @@ |
1165 | importer.process_books(['Book']) |
1166 | |
1167 | # THEN: find_and_create_book should not have been called |
1168 | - self.assertFalse(self.mocked_find_and_create_book.called) |
1169 | + assert self.mocked_find_and_create_book.called is False |
1170 | |
1171 | def test_process_books_completes(self): |
1172 | """ |
1173 | @@ -226,11 +226,10 @@ |
1174 | importer.process_books([book1, book2]) |
1175 | |
1176 | # THEN: find_and_create_book and process_books should be called with the details from the mocked books |
1177 | - self.assertEqual(self.mocked_find_and_create_book.call_args_list, |
1178 | - [call('Name1', 2, 10), call('Name2', 2, 10)]) |
1179 | - self.assertEqual(mocked_process_chapters.call_args_list, |
1180 | - [call('db_book1', 'Chapter1'), call('db_book2', 'Chapter2')]) |
1181 | - self.assertEqual(importer.session.commit.call_count, 2) |
1182 | + assert self.mocked_find_and_create_book.call_args_list == [call('Name1', 2, 10), call('Name2', 2, 10)] |
1183 | + assert mocked_process_chapters.call_args_list == \ |
1184 | + [call('db_book1', 'Chapter1'), call('db_book2', 'Chapter2')] |
1185 | + assert importer.session.commit.call_count == 2 |
1186 | |
1187 | def test_process_chapters_stop_import(self): |
1188 | """ |
1189 | @@ -245,7 +244,7 @@ |
1190 | importer.process_chapters('Book', ['Chapter1']) |
1191 | |
1192 | # THEN: importer.parse_chapter_number not have been called |
1193 | - self.assertFalse(importer.parse_chapter_number.called) |
1194 | + assert importer.parse_chapter_number.called is False |
1195 | |
1196 | @patch('openlp.plugins.bibles.lib.importers.opensong.parse_chapter_number', **{'side_effect': [1, 2]}) |
1197 | def test_process_chapters_completes(self, mocked_parse_chapter_number): |
1198 | @@ -273,12 +272,11 @@ |
1199 | importer.process_chapters(book, [chapter1, chapter2]) |
1200 | |
1201 | # THEN: parse_chapter_number, process_verses and increment_process_bar should have been called |
1202 | - self.assertEqual(mocked_parse_chapter_number.call_args_list, [call('1', 0), call('2', 1)]) |
1203 | - self.assertEqual( |
1204 | - importer.process_verses.call_args_list, |
1205 | - [call(book, 1, ['Chapter1 Verses']), call(book, 2, ['Chapter2 Verses'])]) |
1206 | - self.assertEqual(importer.wizard.increment_progress_bar.call_args_list, |
1207 | - [call('Importing Book 1...'), call('Importing Book 2...')]) |
1208 | + assert mocked_parse_chapter_number.call_args_list == [call('1', 0), call('2', 1)] |
1209 | + assert importer.process_verses.call_args_list == \ |
1210 | + [call(book, 1, ['Chapter1 Verses']), call(book, 2, ['Chapter2 Verses'])] |
1211 | + assert importer.wizard.increment_progress_bar.call_args_list == [call('Importing Book 1...'), |
1212 | + call('Importing Book 2...')] |
1213 | |
1214 | def test_process_verses_stop_import(self): |
1215 | """ |
1216 | @@ -293,7 +291,7 @@ |
1217 | importer.process_verses('Book', 1, 'Verses') |
1218 | |
1219 | # THEN: importer.parse_verse_number not have been called |
1220 | - self.assertFalse(importer.parse_verse_number.called) |
1221 | + assert importer.parse_verse_number.called is False |
1222 | |
1223 | def test_process_verses_completes(self): |
1224 | """ |
1225 | @@ -324,11 +322,10 @@ |
1226 | importer.process_verses(book, 1, [verse1, verse2]) |
1227 | |
1228 | # THEN: parse_chapter_number, process_verses and increment_process_bar should have been called |
1229 | - self.assertEqual(mocked_parse_verse_number.call_args_list, [call('1', 0), call('2', 1)]) |
1230 | - self.assertEqual(mocked_get_text.call_args_list, [call(verse1), call(verse2)]) |
1231 | - self.assertEqual( |
1232 | - importer.create_verse.call_args_list, |
1233 | - [call(1, 1, 1, 'Verse1 Text'), call(1, 1, 2, 'Verse2 Text')]) |
1234 | + assert mocked_parse_verse_number.call_args_list == [call('1', 0), call('2', 1)] |
1235 | + assert mocked_get_text.call_args_list == [call(verse1), call(verse2)] |
1236 | + assert importer.create_verse.call_args_list == \ |
1237 | + [call(1, 1, 1, 'Verse1 Text'), call(1, 1, 2, 'Verse2 Text')] |
1238 | |
1239 | def test_do_import_parse_xml_fails(self): |
1240 | """ |
1241 | @@ -345,8 +342,8 @@ |
1242 | result = importer.do_import() |
1243 | |
1244 | # THEN: do_import should return False and get_language_id should have not been called |
1245 | - self.assertFalse(result) |
1246 | - self.assertFalse(mocked_language_id.called) |
1247 | + assert result is False |
1248 | + assert mocked_language_id.called is False |
1249 | |
1250 | def test_do_import_no_language(self): |
1251 | """ |
1252 | @@ -364,8 +361,8 @@ |
1253 | result = importer.do_import() |
1254 | |
1255 | # THEN: do_import should return False and process_books should have not been called |
1256 | - self.assertFalse(result) |
1257 | - self.assertFalse(mocked_process_books.called) |
1258 | + assert result is False |
1259 | + assert mocked_process_books.called is False |
1260 | |
1261 | def test_do_import_completes(self): |
1262 | """ |
1263 | @@ -383,7 +380,7 @@ |
1264 | result = importer.do_import() |
1265 | |
1266 | # THEN: do_import should return True |
1267 | - self.assertTrue(result) |
1268 | + assert result is True |
1269 | |
1270 | |
1271 | class TestOpenSongImportFileImports(TestCase, TestMixin): |
1272 | @@ -421,6 +418,6 @@ |
1273 | importer.do_import() |
1274 | |
1275 | # THEN: The create_verse() method should have been called with each verse in the file. |
1276 | - self.assertTrue(importer.create_verse.called) |
1277 | + assert importer.create_verse.called is True |
1278 | for verse_tag, verse_text in test_data['verses']: |
1279 | importer.create_verse.assert_any_call(importer.create_book().id, 1, int(verse_tag), verse_text) |
1280 | |
1281 | === modified file 'tests/functional/openlp_plugins/bibles/test_osisimport.py' |
1282 | --- tests/functional/openlp_plugins/bibles/test_osisimport.py 2017-11-06 22:41:36 +0000 |
1283 | +++ tests/functional/openlp_plugins/bibles/test_osisimport.py 2017-12-24 07:19:49 +0000 |
1284 | @@ -67,7 +67,7 @@ |
1285 | importer = OSISBible(mocked_manager, path='.', name='.', file_path=None) |
1286 | |
1287 | # THEN: The importer should be an instance of BibleDB |
1288 | - self.assertIsInstance(importer, BibleDB) |
1289 | + assert isinstance(importer, BibleDB) |
1290 | |
1291 | def test_process_books_stop_import(self): |
1292 | """ |
1293 | @@ -82,7 +82,7 @@ |
1294 | importer.process_books(mocked_data) |
1295 | |
1296 | # THEN: find_and_create_book should not have been called |
1297 | - self.assertFalse(self.mocked_find_and_create_book.called) |
1298 | + assert self.mocked_find_and_create_book.called is False |
1299 | |
1300 | def test_process_books_completes(self): |
1301 | """ |
1302 | @@ -106,11 +106,9 @@ |
1303 | importer.process_books(mocked_data) |
1304 | |
1305 | # THEN: find_and_create_book and process_books should be called with the details from the mocked books |
1306 | - self.assertEqual(self.mocked_find_and_create_book.call_args_list, |
1307 | - [call('Name1', 2, 10), call('Name2', 2, 10)]) |
1308 | - self.assertEqual(mocked_process_chapters.call_args_list, |
1309 | - [call('db_book1', book1), call('db_book2', book2)]) |
1310 | - self.assertEqual(importer.session.commit.call_count, 2) |
1311 | + assert self.mocked_find_and_create_book.call_args_list == [call('Name1', 2, 10), call('Name2', 2, 10)] |
1312 | + assert mocked_process_chapters.call_args_list == [call('db_book1', book1), call('db_book2', book2)] |
1313 | + assert importer.session.commit.call_count == 2 |
1314 | |
1315 | def test_process_chapters_verse_in_chapter_verse_text(self): |
1316 | """ |
1317 | @@ -185,8 +183,8 @@ |
1318 | importer.process_chapters(test_book, [test_chapter]) |
1319 | |
1320 | # THEN: neither set_current_chapter or process_verse should have been called |
1321 | - self.assertFalse(mocked_set_current_chapter.called) |
1322 | - self.assertFalse(mocked_process_verse.called) |
1323 | + assert mocked_set_current_chapter.called is False |
1324 | + assert mocked_process_verse.called is False |
1325 | |
1326 | def test_process_chapters_milestones_chapter_sid(self): |
1327 | """ |
1328 | @@ -209,7 +207,7 @@ |
1329 | |
1330 | # THEN: set_current_chapter should have been called with the test data |
1331 | mocked_set_current_chapter.assert_called_once_with(test_book.name, 2) |
1332 | - self.assertFalse(mocked_process_verse.called) |
1333 | + assert mocked_process_verse.called is False |
1334 | |
1335 | def test_process_chapters_milestones_verse_tag(self): |
1336 | """ |
1337 | @@ -233,7 +231,7 @@ |
1338 | importer.process_chapters(test_book, [test_verse]) |
1339 | |
1340 | # THEN: process_verse should have been called with the test data |
1341 | - self.assertFalse(mocked_set_current_chapter.called) |
1342 | + assert mocked_set_current_chapter.called is False |
1343 | mocked_process_verse.assert_called_once_with(test_book, 0, test_verse, use_milestones=True) |
1344 | |
1345 | def test_process_verse_no_osis_id(self): |
1346 | @@ -252,7 +250,7 @@ |
1347 | importer.process_verse(test_book, 2, test_verse) |
1348 | |
1349 | # THEN: create_verse should not have been called |
1350 | - self.assertFalse(self.mocked_create_verse.called) |
1351 | + assert self.mocked_create_verse.called is False |
1352 | |
1353 | def test_process_verse_use_milestones_no_s_id(self): |
1354 | """ |
1355 | @@ -271,7 +269,7 @@ |
1356 | importer.process_verse(test_book, 2, test_verse) |
1357 | |
1358 | # THEN: create_verse should not have been called |
1359 | - self.assertFalse(self.mocked_create_verse.called) |
1360 | + assert self.mocked_create_verse.called is False |
1361 | |
1362 | def test_process_verse_use_milestones_no_tail(self): |
1363 | """ |
1364 | @@ -289,7 +287,7 @@ |
1365 | importer.process_verse(test_book, 2, test_verse, use_milestones=True) |
1366 | |
1367 | # THEN: create_verse should not have been called |
1368 | - self.assertFalse(self.mocked_create_verse.called) |
1369 | + assert self.mocked_create_verse.called is False |
1370 | |
1371 | def test_process_verse_use_milestones_success(self): |
1372 | """ |
1373 | @@ -327,7 +325,7 @@ |
1374 | importer.process_verse(test_book, 2, test_verse) |
1375 | |
1376 | # THEN: create_verse should not have been called |
1377 | - self.assertFalse(self.mocked_create_verse.called) |
1378 | + assert self.mocked_create_verse.called is False |
1379 | |
1380 | def test_process_verse_success(self): |
1381 | """ |
1382 | @@ -363,8 +361,8 @@ |
1383 | result = importer.do_import() |
1384 | |
1385 | # THEN: do_import should return False and get_language_id should have not been called |
1386 | - self.assertFalse(result) |
1387 | - self.assertFalse(mocked_language_id.called) |
1388 | + assert result is False |
1389 | + assert mocked_language_id.called is False |
1390 | |
1391 | def test_do_import_no_language(self): |
1392 | """ |
1393 | @@ -382,8 +380,8 @@ |
1394 | result = importer.do_import() |
1395 | |
1396 | # THEN: do_import should return False and process_books should have not been called |
1397 | - self.assertFalse(result) |
1398 | - self.assertFalse(mocked_process_books.called) |
1399 | + assert result is False |
1400 | + assert mocked_process_books.called is False |
1401 | |
1402 | def test_do_import_completes(self): |
1403 | """ |
1404 | @@ -401,7 +399,7 @@ |
1405 | result = importer.do_import() |
1406 | |
1407 | # THEN: do_import should return True |
1408 | - self.assertTrue(result) |
1409 | + assert result is True |
1410 | |
1411 | |
1412 | class TestOsisImportFileImports(TestCase): |
1413 | @@ -442,7 +440,7 @@ |
1414 | importer.do_import() |
1415 | |
1416 | # THEN: The create_verse() method should have been called with each verse in the file. |
1417 | - self.assertTrue(importer.create_verse.called) |
1418 | + assert importer.create_verse.called is True |
1419 | for verse_tag, verse_text in test_data['verses']: |
1420 | importer.create_verse.assert_any_call(importer.create_book().id, 1, verse_tag, verse_text) |
1421 | |
1422 | @@ -472,7 +470,7 @@ |
1423 | importer.do_import() |
1424 | |
1425 | # THEN: The create_verse() method should have been called with each verse in the file. |
1426 | - self.assertTrue(importer.create_verse.called) |
1427 | + assert importer.create_verse.called is True |
1428 | for verse_tag, verse_text in test_data['verses']: |
1429 | importer.create_verse.assert_any_call(importer.create_book().id, 1, verse_tag, verse_text) |
1430 | |
1431 | @@ -502,7 +500,7 @@ |
1432 | importer.do_import() |
1433 | |
1434 | # THEN: The create_verse() method should have been called with each verse in the file. |
1435 | - self.assertTrue(importer.create_verse.called) |
1436 | + assert importer.create_verse.called |
1437 | for verse_tag, verse_text in test_data['verses']: |
1438 | importer.create_verse.assert_any_call(importer.create_book().id, 1, verse_tag, verse_text) |
1439 | |
1440 | @@ -532,6 +530,6 @@ |
1441 | importer.do_import() |
1442 | |
1443 | # THEN: The create_verse() method should have been called with each verse in the file. |
1444 | - self.assertTrue(importer.create_verse.called) |
1445 | + assert importer.create_verse.called is True |
1446 | for verse_tag, verse_text in test_data['verses']: |
1447 | importer.create_verse.assert_any_call(importer.create_book().id, 1, verse_tag, verse_text) |
1448 | |
1449 | === modified file 'tests/functional/openlp_plugins/bibles/test_swordimport.py' |
1450 | --- tests/functional/openlp_plugins/bibles/test_swordimport.py 2017-10-10 19:09:20 +0000 |
1451 | +++ tests/functional/openlp_plugins/bibles/test_swordimport.py 2017-12-24 07:19:49 +0000 |
1452 | @@ -67,7 +67,7 @@ |
1453 | importer = SwordBible(mocked_manager, path='.', name='.', file_path=None, sword_key='', sword_path='') |
1454 | |
1455 | # THEN: The importer should be an instance of BibleDB |
1456 | - self.assertIsInstance(importer, BibleDB) |
1457 | + assert isinstance(importer, BibleDB) |
1458 | |
1459 | @patch('openlp.plugins.bibles.lib.importers.sword.SwordBible.application') |
1460 | @patch('openlp.plugins.bibles.lib.importers.sword.modules') |
1461 | @@ -106,6 +106,6 @@ |
1462 | importer.do_import() |
1463 | |
1464 | # THEN: The create_verse() method should have been called with each verse in the file. |
1465 | - self.assertTrue(importer.create_verse.called) |
1466 | + assert importer.create_verse.called is True |
1467 | for verse_tag, verse_text in test_data['verses']: |
1468 | importer.create_verse.assert_any_call(importer.create_book().id, 1, int(verse_tag), verse_text) |
1469 | |
1470 | === modified file 'tests/functional/openlp_plugins/bibles/test_versereferencelist.py' |
1471 | --- tests/functional/openlp_plugins/bibles/test_versereferencelist.py 2016-12-31 11:01:36 +0000 |
1472 | +++ tests/functional/openlp_plugins/bibles/test_versereferencelist.py 2017-12-24 07:19:49 +0000 |
1473 | @@ -48,14 +48,12 @@ |
1474 | reference_list.add(book, chapter, verse, version, copyright_, permission) |
1475 | |
1476 | # THEN: The entries should be in the first entry of the list |
1477 | - self.assertEqual(reference_list.current_index, 0, 'The current index should be 0') |
1478 | - self.assertEqual(reference_list.verse_list[0]['book'], book, 'The book in first entry should be %s' % book) |
1479 | - self.assertEqual(reference_list.verse_list[0]['chapter'], chapter, 'The chapter in first entry should be %u' % |
1480 | - chapter) |
1481 | - self.assertEqual(reference_list.verse_list[0]['start'], verse, 'The start in first entry should be %u' % verse) |
1482 | - self.assertEqual(reference_list.verse_list[0]['version'], version, 'The version in first entry should be %s' % |
1483 | - version) |
1484 | - self.assertEqual(reference_list.verse_list[0]['end'], verse, 'The end in first entry should be %u' % verse) |
1485 | + assert reference_list.current_index == 0, 'The current index should be 0' |
1486 | + assert reference_list.verse_list[0]['book'] == book, 'The book in first entry should be %s' % book |
1487 | + assert reference_list.verse_list[0]['chapter'] == chapter, 'The chapter in first entry should be %u' % chapter |
1488 | + assert reference_list.verse_list[0]['start'] == verse, 'The start in first entry should be %u' % verse |
1489 | + assert reference_list.verse_list[0]['version'] == version, 'The version in first entry should be %s' % version |
1490 | + assert reference_list.verse_list[0]['end'] == verse, 'The end in first entry should be %u' % verse |
1491 | |
1492 | def test_add_next_verse(self): |
1493 | """ |
1494 | @@ -76,9 +74,8 @@ |
1495 | reference_list.add(book, chapter, next_verse, version, copyright_, permission) |
1496 | |
1497 | # THEN: The current index should be 0 and the end pointer of the entry should be '2' |
1498 | - self.assertEqual(reference_list.current_index, 0, 'The current index should be 0') |
1499 | - self.assertEqual(reference_list.verse_list[0]['end'], next_verse, |
1500 | - 'The end in first entry should be %u' % next_verse) |
1501 | + assert reference_list.current_index == 0, 'The current index should be 0' |
1502 | + assert reference_list.verse_list[0]['end'] == next_verse, 'The end in first entry should be %u' % next_verse |
1503 | |
1504 | def test_add_another_verse(self): |
1505 | """ |
1506 | @@ -101,7 +98,7 @@ |
1507 | reference_list.add(another_book, another_chapter, another_verse, version, copyright_, permission) |
1508 | |
1509 | # THEN: the current index should be 1 |
1510 | - self.assertEqual(reference_list.current_index, 1, 'The current index should be 1') |
1511 | + assert reference_list.current_index == 1, 'The current index should be 1' |
1512 | |
1513 | def test_add_version(self): |
1514 | """ |
1515 | @@ -117,10 +114,10 @@ |
1516 | reference_list.add_version(version, copyright_, permission) |
1517 | |
1518 | # THEN: the data will be appended to the list |
1519 | - self.assertEqual(len(reference_list.version_list), 1, 'The version data should be appended') |
1520 | - self.assertEqual(reference_list.version_list[0], |
1521 | - {'version': version, 'copyright': copyright_, 'permission': permission}, |
1522 | - 'The version data should be appended') |
1523 | + assert len(reference_list.version_list) == 1, 'The version data should be appended' |
1524 | + assert reference_list.version_list[0] == \ |
1525 | + {'version': version, 'copyright': copyright_, 'permission': permission}, \ |
1526 | + 'The version data should be appended' |
1527 | |
1528 | def test_add_existing_version(self): |
1529 | """ |
1530 | @@ -137,4 +134,4 @@ |
1531 | reference_list.add_version(version, copyright_, permission) |
1532 | |
1533 | # THEN: the data will not be appended to the list |
1534 | - self.assertEqual(len(reference_list.version_list), 1, 'The version data should not be appended') |
1535 | + assert len(reference_list.version_list) == 1, 'The version data should not be appended' |
1536 | |
1537 | === modified file 'tests/functional/openlp_plugins/bibles/test_zefaniaimport.py' |
1538 | --- tests/functional/openlp_plugins/bibles/test_zefaniaimport.py 2017-10-10 19:09:20 +0000 |
1539 | +++ tests/functional/openlp_plugins/bibles/test_zefaniaimport.py 2017-12-24 07:19:49 +0000 |
1540 | @@ -59,7 +59,7 @@ |
1541 | importer = ZefaniaBible(mocked_manager, path='.', name='.', file_path=None) |
1542 | |
1543 | # THEN: The importer should be an instance of BibleDB |
1544 | - self.assertIsInstance(importer, BibleDB) |
1545 | + assert isinstance(importer, BibleDB) |
1546 | |
1547 | def test_file_import(self): |
1548 | """ |
1549 | @@ -86,7 +86,7 @@ |
1550 | importer.do_import() |
1551 | |
1552 | # THEN: The create_verse() method should have been called with each verse in the file. |
1553 | - self.assertTrue(importer.create_verse.called) |
1554 | + assert importer.create_verse.called is True |
1555 | for verse_tag, verse_text in test_data['verses']: |
1556 | importer.create_verse.assert_any_call(importer.create_book().id, 1, verse_tag, verse_text) |
1557 | importer.create_book.assert_any_call('Genesis', 1, 1) |
1558 | @@ -116,7 +116,7 @@ |
1559 | importer.do_import() |
1560 | |
1561 | # THEN: The create_verse() method should have been called with each verse in the file. |
1562 | - self.assertTrue(importer.create_verse.called) |
1563 | + assert importer.create_verse.called is True |
1564 | for verse_tag, verse_text in test_data['verses']: |
1565 | importer.create_verse.assert_any_call(importer.create_book().id, 1, verse_tag, verse_text) |
1566 | importer.create_book.assert_any_call('Exodus', 2, 1) |
1567 | |
1568 | === modified file 'tests/functional/openlp_plugins/custom/test_mediaitem.py' |
1569 | --- tests/functional/openlp_plugins/custom/test_mediaitem.py 2017-10-07 07:05:07 +0000 |
1570 | +++ tests/functional/openlp_plugins/custom/test_mediaitem.py 2017-12-24 07:19:49 +0000 |
1571 | @@ -73,7 +73,7 @@ |
1572 | item = self.media_item.service_load(service_item) |
1573 | |
1574 | # THEN: the processing should be ignored |
1575 | - self.assertEqual(item, None, 'The Service item is inactive so processing should be bypassed') |
1576 | + assert item is None, 'The Service item is inactive so processing should be bypassed' |
1577 | |
1578 | def test_service_load_basic_custom_false(self): |
1579 | """ |
1580 | @@ -95,8 +95,8 @@ |
1581 | self.media_item.service_load(service_item) |
1582 | |
1583 | # THEN: the item should not be added to the database. |
1584 | - self.assertEqual(self.media_item.create_from_service_item.call_count, 0, |
1585 | - 'The item should not have been added to the database') |
1586 | + assert self.media_item.create_from_service_item.call_count == 0, \ |
1587 | + 'The item should not have been added to the database' |
1588 | |
1589 | def test_service_load_basic_custom_true(self): |
1590 | """ |
1591 | @@ -118,5 +118,5 @@ |
1592 | self.media_item.service_load(service_item) |
1593 | |
1594 | # THEN: the item should not be added to the database. |
1595 | - self.assertEqual(self.media_item.create_from_service_item.call_count, 1, |
1596 | - 'The item should have been added to the database') |
1597 | + assert self.media_item.create_from_service_item.call_count == 1, \ |
1598 | + 'The item should have been added to the database' |
1599 | |
1600 | === modified file 'tests/functional/openlp_plugins/images/test_imagetab.py' |
1601 | --- tests/functional/openlp_plugins/images/test_imagetab.py 2017-10-07 07:05:07 +0000 |
1602 | +++ tests/functional/openlp_plugins/images/test_imagetab.py 2017-12-24 07:19:49 +0000 |
1603 | @@ -74,8 +74,8 @@ |
1604 | # WHEN: the save is invoked |
1605 | self.form.save() |
1606 | # THEN: the post process should not be requested |
1607 | - self.assertEqual(0, self.form.settings_form.register_post_process.call_count, |
1608 | - 'Image Post processing should not have been requested') |
1609 | + assert 0 == self.form.settings_form.register_post_process.call_count, \ |
1610 | + 'Image Post processing should not have been requested' |
1611 | |
1612 | def test_save_tab_change(self): |
1613 | """ |
1614 | @@ -86,7 +86,7 @@ |
1615 | # WHEN: the save is invoked |
1616 | self.form.save() |
1617 | # THEN: the post process should be requested |
1618 | - self.assertEqual(1, self.form.settings_form.register_post_process.call_count, |
1619 | - 'Image Post processing should have been requested') |
1620 | + assert 1 == self.form.settings_form.register_post_process.call_count, \ |
1621 | + 'Image Post processing should have been requested' |
1622 | # THEN: The color should be set |
1623 | - self.assertEqual(self.form.background_color, '#999999', 'The updated color should have been saved') |
1624 | + assert self.form.background_color == '#999999', 'The updated color should have been saved' |
1625 | |
1626 | === modified file 'tests/functional/openlp_plugins/images/test_lib.py' |
1627 | --- tests/functional/openlp_plugins/images/test_lib.py 2017-11-15 18:33:21 +0000 |
1628 | +++ tests/functional/openlp_plugins/images/test_lib.py 2017-12-24 07:19:49 +0000 |
1629 | @@ -98,8 +98,8 @@ |
1630 | self.media_item.save_new_images_list(image_list) |
1631 | |
1632 | # THEN: The save_object() method should not have been called |
1633 | - self.assertEquals(self.media_item.manager.save_object.call_count, 0, |
1634 | - 'The save_object() method should not have been called') |
1635 | + assert self.media_item.manager.save_object.call_count == 0, \ |
1636 | + 'The save_object() method should not have been called' |
1637 | |
1638 | @patch('openlp.plugins.images.lib.mediaitem.ImageMediaItem.load_full_list') |
1639 | def test_save_new_images_list_single_image_with_reload(self, mocked_load_full_list): |
1640 | @@ -115,7 +115,7 @@ |
1641 | self.media_item.save_new_images_list(image_list, reload_list=True) |
1642 | |
1643 | # THEN: load_full_list() should have been called |
1644 | - self.assertEquals(mocked_load_full_list.call_count, 1, 'load_full_list() should have been called') |
1645 | + assert mocked_load_full_list.call_count == 1, 'load_full_list() should have been called' |
1646 | |
1647 | # CLEANUP: Remove added attribute from ImageFilenames |
1648 | delattr(ImageFilenames, 'file_path') |
1649 | @@ -133,7 +133,7 @@ |
1650 | self.media_item.save_new_images_list(image_list, reload_list=False) |
1651 | |
1652 | # THEN: load_full_list() should not have been called |
1653 | - self.assertEquals(mocked_load_full_list.call_count, 0, 'load_full_list() should not have been called') |
1654 | + assert mocked_load_full_list.call_count == 0, 'load_full_list() should not have been called' |
1655 | |
1656 | @patch('openlp.plugins.images.lib.mediaitem.ImageMediaItem.load_full_list') |
1657 | def test_save_new_images_list_multiple_images(self, mocked_load_full_list): |
1658 | @@ -148,8 +148,8 @@ |
1659 | self.media_item.save_new_images_list(image_list, reload_list=False) |
1660 | |
1661 | # THEN: load_full_list() should not have been called |
1662 | - self.assertEquals(self.media_item.manager.save_object.call_count, 3, |
1663 | - 'load_full_list() should have been called three times') |
1664 | + assert self.media_item.manager.save_object.call_count == 3, \ |
1665 | + 'load_full_list() should have been called three times' |
1666 | |
1667 | @patch('openlp.plugins.images.lib.mediaitem.ImageMediaItem.load_full_list') |
1668 | def test_save_new_images_list_other_objects_in_list(self, mocked_load_full_list): |
1669 | @@ -164,8 +164,7 @@ |
1670 | self.media_item.save_new_images_list(image_list, reload_list=False) |
1671 | |
1672 | # THEN: load_full_list() should not have been called |
1673 | - self.assertEquals(self.media_item.manager.save_object.call_count, 2, |
1674 | - 'load_full_list() should have been called only once') |
1675 | + assert self.media_item.manager.save_object.call_count == 2, 'load_full_list() should have been called only once' |
1676 | |
1677 | def test_on_reset_click(self): |
1678 | """ |
1679 | @@ -201,9 +200,9 @@ |
1680 | self.media_item.recursively_delete_group(test_group) |
1681 | |
1682 | # THEN: delete_file() should have been called 12 times and manager.delete_object() 7 times. |
1683 | - self.assertEquals(mocked_delete_file.call_count, 12, 'delete_file() should have been called 12 times') |
1684 | - self.assertEquals(self.media_item.manager.delete_object.call_count, 7, |
1685 | - 'manager.delete_object() should be called exactly 7 times') |
1686 | + assert mocked_delete_file.call_count == 12, 'delete_file() should have been called 12 times' |
1687 | + assert self.media_item.manager.delete_object.call_count == 7, \ |
1688 | + 'manager.delete_object() should be called exactly 7 times' |
1689 | |
1690 | # CLEANUP: Remove added attribute from Image Filenames and ImageGroups |
1691 | delattr(ImageFilenames, 'group_id') |
1692 | @@ -258,7 +257,7 @@ |
1693 | self.media_item.on_delete_click() |
1694 | |
1695 | # THEN: delete_file should have been called twice |
1696 | - self.assertEquals(mocked_delete_file.call_count, 2, 'delete_file() should have been called twice') |
1697 | + assert mocked_delete_file.call_count == 2, 'delete_file() should have been called twice' |
1698 | |
1699 | def test_create_item_from_id(self): |
1700 | """ |
1701 | @@ -276,9 +275,9 @@ |
1702 | item = self.media_item.create_item_from_id('1') |
1703 | |
1704 | # THEN: A QTreeWidgetItem should be created with the above model object as it's data |
1705 | - self.assertIsInstance(item, QtWidgets.QTreeWidgetItem) |
1706 | - self.assertEqual('test_file_1.jpg', item.text(0)) |
1707 | + assert isinstance(item, QtWidgets.QTreeWidgetItem) |
1708 | + assert 'test_file_1.jpg' == item.text(0) |
1709 | item_data = item.data(0, QtCore.Qt.UserRole) |
1710 | - self.assertIsInstance(item_data, ImageFilenames) |
1711 | - self.assertEqual(1, item_data.id) |
1712 | - self.assertEqual(Path('/', 'tmp', 'test_file_1.jpg'), item_data.file_path) |
1713 | + assert isinstance(item_data, ImageFilenames) |
1714 | + assert 1 == item_data.id |
1715 | + assert Path('/', 'tmp', 'test_file_1.jpg') == item_data.file_path |
1716 | |
1717 | === modified file 'tests/functional/openlp_plugins/images/test_upgrade.py' |
1718 | --- tests/functional/openlp_plugins/images/test_upgrade.py 2017-10-10 02:29:56 +0000 |
1719 | +++ tests/functional/openlp_plugins/images/test_upgrade.py 2017-12-24 07:19:49 +0000 |
1720 | @@ -80,6 +80,6 @@ |
1721 | 2: Path('/', 'test', 'dir', 'image2.jpg'), |
1722 | 3: Path('/', 'test', 'dir', 'subdir', 'image3.jpg')} |
1723 | |
1724 | - self.assertEqual(len(upgraded_results), 3) |
1725 | + assert len(upgraded_results) == 3 |
1726 | for result in upgraded_results: |
1727 | - self.assertEqual(expected_result_data[result.id], result.file_path) |
1728 | + assert expected_result_data[result.id] == result.file_path |
1729 | |
1730 | === modified file 'tests/functional/openlp_plugins/media/test_mediaitem.py' |
1731 | --- tests/functional/openlp_plugins/media/test_mediaitem.py 2017-10-10 07:08:44 +0000 |
1732 | +++ tests/functional/openlp_plugins/media/test_mediaitem.py 2017-12-24 07:19:49 +0000 |
1733 | @@ -71,7 +71,7 @@ |
1734 | # WHEN: Retrieving the test file |
1735 | result = self.media_item.search('test.mp4', False) |
1736 | # THEN: a file should be found |
1737 | - self.assertEqual(result, [['test.mp4', 'test.mp4']], 'The result file contain the file name') |
1738 | + assert result == [['test.mp4', 'test.mp4']], 'The result file contain the file name' |
1739 | |
1740 | def test_search_not_found(self): |
1741 | """ |
1742 | @@ -82,4 +82,4 @@ |
1743 | # WHEN: Retrieving the test file |
1744 | result = self.media_item.search('test.mpx', False) |
1745 | # THEN: a file should be found |
1746 | - self.assertEqual(result, [], 'The result file should be empty') |
1747 | + assert result == [], 'The result file should be empty' |
1748 | |
1749 | === modified file 'tests/functional/openlp_plugins/media/test_mediaplugin.py' |
1750 | --- tests/functional/openlp_plugins/media/test_mediaplugin.py 2017-10-10 07:08:44 +0000 |
1751 | +++ tests/functional/openlp_plugins/media/test_mediaplugin.py 2017-12-24 07:19:49 +0000 |
1752 | @@ -56,9 +56,9 @@ |
1753 | # GIVEN: The MediaPlugin |
1754 | # WHEN: Retrieving the about text |
1755 | # THEN: about() should return a string object |
1756 | - self.assertIsInstance(MediaPlugin.about(), str) |
1757 | + assert isinstance(MediaPlugin.about(), str) |
1758 | # THEN: about() should return a non-empty string |
1759 | - self.assertNotEquals(len(MediaPlugin.about()), 0) |
1760 | + assert len(MediaPlugin.about()) is not 0 |
1761 | |
1762 | @patch('openlp.plugins.media.mediaplugin.check_binary_exists') |
1763 | def test_process_check_binary_pass(self, mocked_checked_binary_exists): |
1764 | @@ -71,7 +71,7 @@ |
1765 | result = process_check_binary('MediaInfo') |
1766 | |
1767 | # THEN: The the result should be True |
1768 | - self.assertTrue(result, 'Mediainfo should have been found') |
1769 | + assert result is True, 'Mediainfo should have been found' |
1770 | |
1771 | @patch('openlp.plugins.media.mediaplugin.check_binary_exists') |
1772 | def test_process_check_binary_fail(self, mocked_checked_binary_exists): |
1773 | @@ -84,4 +84,4 @@ |
1774 | result = process_check_binary("MediaInfo1") |
1775 | |
1776 | # THEN: The the result should be True |
1777 | - self.assertFalse(result, "Mediainfo should not have been found") |
1778 | + assert result is False, "Mediainfo should not have been found" |
1779 | |
1780 | === modified file 'tests/functional/openlp_plugins/presentations/test_impresscontroller.py' |
1781 | --- tests/functional/openlp_plugins/presentations/test_impresscontroller.py 2017-12-17 15:28:21 +0000 |
1782 | +++ tests/functional/openlp_plugins/presentations/test_impresscontroller.py 2017-12-24 07:19:49 +0000 |
1783 | @@ -69,8 +69,7 @@ |
1784 | controller = ImpressController(plugin=self.mock_plugin) |
1785 | |
1786 | # THEN: The name of the presentation controller should be correct |
1787 | - self.assertEqual('Impress', controller.name, |
1788 | - 'The name of the presentation controller should be correct') |
1789 | + assert 'Impress' == controller.name, 'The name of the presentation controller should be correct' |
1790 | |
1791 | @patch('openlp.plugins.presentations.lib.impresscontroller.log') |
1792 | def test_check_available(self, mocked_log): |
1793 | @@ -179,22 +178,21 @@ |
1794 | result = self.doc._ImpressDocument__get_text_from_page(0, TextType.Notes) |
1795 | |
1796 | # THEN: the result should be an empty string |
1797 | - self.assertEqual(result, '', 'Result should be an empty string') |
1798 | + assert result == '', 'Result should be an empty string' |
1799 | |
1800 | # WHEN: regardless of the type of text, index 0x00 is out of bounds |
1801 | result = self.doc._ImpressDocument__get_text_from_page(0, TextType.Title) |
1802 | |
1803 | # THEN: result should be an empty string |
1804 | - self.assertEqual(result, '', 'Result should be an empty string') |
1805 | + assert result == '', 'Result should be an empty string' |
1806 | |
1807 | # WHEN: when called with 2, it should also be out of bounds |
1808 | result = self.doc._ImpressDocument__get_text_from_page(2, TextType.SlideText) |
1809 | |
1810 | # THEN: result should be an empty string ... and, getByIndex should |
1811 | # have never been called |
1812 | - self.assertEqual(result, '', 'Result should be an empty string') |
1813 | - self.assertEqual(self.doc.document.getDrawPages().getByIndex.call_count, 0, |
1814 | - 'There should be no call to getByIndex') |
1815 | + assert result == '', 'Result should be an empty string' |
1816 | + assert self.doc.document.getDrawPages().getByIndex.call_count == 0, 'There should be no call to getByIndex' |
1817 | |
1818 | def test_get_text_from_page_wrong_type(self): |
1819 | """ |
1820 | @@ -208,9 +206,8 @@ |
1821 | result = self.doc._ImpressDocument__get_text_from_page(1, 3) |
1822 | |
1823 | # THEN: result should be an empty string |
1824 | - self.assertEqual(result, '', 'Result should be and empty string') |
1825 | - self.assertEqual(self.doc.document.getDrawPages().getByIndex.call_count, 0, |
1826 | - 'There should be no call to getByIndex') |
1827 | + assert result == '', 'Result should be and empty string' |
1828 | + assert self.doc.document.getDrawPages().getByIndex.call_count == 0, 'There should be no call to getByIndex' |
1829 | |
1830 | def test_get_text_from_page_valid_params(self): |
1831 | """ |
1832 | @@ -224,19 +221,19 @@ |
1833 | result = self.doc._ImpressDocument__get_text_from_page(1, TextType.Notes) |
1834 | |
1835 | # THEN: result should be 'Note\nNote\n' |
1836 | - self.assertEqual(result, 'Note\nNote\n', 'Result should be \'Note\\n\' times the count of notes in the page') |
1837 | + assert result == 'Note\nNote\n', 'Result should be \'Note\\n\' times the count of notes in the page' |
1838 | |
1839 | # WHEN: get the Title |
1840 | result = self.doc._ImpressDocument__get_text_from_page(1, TextType.Title) |
1841 | |
1842 | # THEN: result should be 'Title\n' |
1843 | - self.assertEqual(result, 'Title\n', 'Result should be exactly \'Title\\n\'') |
1844 | + assert result == 'Title\n', 'Result should be exactly \'Title\\n\'' |
1845 | |
1846 | # WHEN: get all text |
1847 | result = self.doc._ImpressDocument__get_text_from_page(1, TextType.SlideText) |
1848 | |
1849 | # THEN: result should be 'Title\nString\nString\n' |
1850 | - self.assertEqual(result, 'Title\nString\nString\n', 'Result should be exactly \'Title\\nString\\nString\\n\'') |
1851 | + assert result == 'Title\nString\nString\n', 'Result should be exactly \'Title\\nString\\nString\\n\'' |
1852 | |
1853 | def _mock_a_LibreOffice_document(self, page_count, note_count, text_count): |
1854 | """ |
1855 | |
1856 | === modified file 'tests/functional/openlp_plugins/presentations/test_mediaitem.py' |
1857 | --- tests/functional/openlp_plugins/presentations/test_mediaitem.py 2017-11-13 20:07:20 +0000 |
1858 | +++ tests/functional/openlp_plugins/presentations/test_mediaitem.py 2017-12-24 07:19:49 +0000 |
1859 | @@ -81,11 +81,11 @@ |
1860 | self.media_item.build_file_mask_string() |
1861 | |
1862 | # THEN: The file mask should be generated correctly |
1863 | - self.assertIn('*.odp', self.media_item.on_new_file_masks, 'The file mask should contain the odp extension') |
1864 | - self.assertIn('*.ppt', self.media_item.on_new_file_masks, 'The file mask should contain the ppt extension') |
1865 | - self.assertIn('*.pdf', self.media_item.on_new_file_masks, 'The file mask should contain the pdf extension') |
1866 | - self.assertIn('*.xps', self.media_item.on_new_file_masks, 'The file mask should contain the xps extension') |
1867 | - self.assertIn('*.oxps', self.media_item.on_new_file_masks, 'The file mask should contain the oxps extension') |
1868 | + assert '*.odp' in self.media_item.on_new_file_masks, 'The file mask should contain the odp extension' |
1869 | + assert '*.ppt' in self.media_item.on_new_file_masks, 'The file mask should contain the ppt extension' |
1870 | + assert '*.pdf' in self.media_item.on_new_file_masks, 'The file mask should contain the pdf extension' |
1871 | + assert '*.xps' in self.media_item.on_new_file_masks, 'The file mask should contain the xps extension' |
1872 | + assert '*.oxps' in self.media_item.on_new_file_masks, 'The file mask should contain the oxps extension' |
1873 | |
1874 | def test_clean_up_thumbnails(self): |
1875 | """ |
1876 | |
1877 | === modified file 'tests/functional/openlp_plugins/presentations/test_messagelistener.py' |
1878 | --- tests/functional/openlp_plugins/presentations/test_messagelistener.py 2017-10-07 07:05:07 +0000 |
1879 | +++ tests/functional/openlp_plugins/presentations/test_messagelistener.py 2017-12-24 07:19:49 +0000 |
1880 | @@ -73,7 +73,7 @@ |
1881 | ml.startup([mock_item, False, False, False]) |
1882 | |
1883 | # THEN: The controllers will be setup. |
1884 | - self.assertTrue(len(controllers), 'We have loaded a controller') |
1885 | + assert len(controllers) > 0, 'We have loaded a controller' |
1886 | |
1887 | @patch('openlp.plugins.presentations.lib.mediaitem.MessageListener._setup') |
1888 | def test_start_presentation_with_no_player(self, media_mock): |
1889 | @@ -105,7 +105,7 @@ |
1890 | ml.startup([mock_item, False, False, False]) |
1891 | |
1892 | # THEN: The controllers will be setup. |
1893 | - self.assertTrue(len(controllers), 'We have loaded a controller') |
1894 | + assert len(controllers) > 0, 'We have loaded a controller' |
1895 | |
1896 | @patch('openlp.plugins.presentations.lib.mediaitem.MessageListener._setup') |
1897 | def test_start_pdf_presentation(self, media_mock): |
1898 | @@ -125,7 +125,7 @@ |
1899 | ml.startup([mock_item, False, False, False]) |
1900 | |
1901 | # THEN: The handler should be set to None |
1902 | - self.assertIsNone(ml.handler, 'The handler should be None') |
1903 | + assert ml.handler is None, 'The handler should be None' |
1904 | |
1905 | |
1906 | class TestController(TestCase, TestMixin): |
1907 | @@ -148,4 +148,4 @@ |
1908 | controller.add_handler(mocked_doc_controller, MagicMock(), True, 0) |
1909 | |
1910 | # THEN: slidenumber should be 0 |
1911 | - self.assertEqual(controller.doc.slidenumber, 0, 'doc.slidenumber should be 0') |
1912 | + assert controller.doc.slidenumber == 0, 'doc.slidenumber should be 0' |
1913 | |
1914 | === modified file 'tests/functional/openlp_plugins/presentations/test_pdfcontroller.py' |
1915 | --- tests/functional/openlp_plugins/presentations/test_pdfcontroller.py 2017-11-18 11:23:15 +0000 |
1916 | +++ tests/functional/openlp_plugins/presentations/test_pdfcontroller.py 2017-12-24 07:19:49 +0000 |
1917 | @@ -92,7 +92,7 @@ |
1918 | controller = PdfController(plugin=self.mock_plugin) |
1919 | |
1920 | # THEN: The name of the presentation controller should be correct |
1921 | - self.assertEqual('Pdf', controller.name, 'The name of the presentation controller should be correct') |
1922 | + assert 'Pdf' == controller.name, 'The name of the presentation controller should be correct' |
1923 | |
1924 | def test_load_pdf(self): |
1925 | """ |
1926 | @@ -111,8 +111,8 @@ |
1927 | loaded = document.load_presentation() |
1928 | |
1929 | # THEN: The load should succeed and we should be able to get a pagecount |
1930 | - self.assertTrue(loaded, 'The loading of the PDF should succeed.') |
1931 | - self.assertEqual(3, document.get_slide_count(), 'The pagecount of the PDF should be 3.') |
1932 | + assert loaded is True, 'The loading of the PDF should succeed.' |
1933 | + assert 3 == document.get_slide_count(), 'The pagecount of the PDF should be 3.' |
1934 | |
1935 | def test_load_pdf_pictures(self): |
1936 | """ |
1937 | @@ -131,15 +131,15 @@ |
1938 | loaded = document.load_presentation() |
1939 | |
1940 | # THEN: The load should succeed and pictures should be created and have been scales to fit the screen |
1941 | - self.assertTrue(loaded, 'The loading of the PDF should succeed.') |
1942 | + assert loaded is True, 'The loading of the PDF should succeed.' |
1943 | image = QtGui.QImage(os.path.join(str(self.temp_folder_path), 'pdf_test1.pdf', 'mainslide001.png')) |
1944 | # Based on the converter used the resolution will differ a bit |
1945 | if controller.gsbin: |
1946 | - self.assertEqual(760, image.height(), 'The height should be 760') |
1947 | - self.assertEqual(537, image.width(), 'The width should be 537') |
1948 | + assert 760 == image.height(), 'The height should be 760' |
1949 | + assert 537 == image.width(), 'The width should be 537' |
1950 | else: |
1951 | - self.assertEqual(768, image.height(), 'The height should be 768') |
1952 | - self.assertEqual(543, image.width(), 'The width should be 543') |
1953 | + assert 768 == image.height(), 'The height should be 768' |
1954 | + assert 543 == image.width(), 'The width should be 543' |
1955 | |
1956 | @patch('openlp.plugins.presentations.lib.pdfcontroller.check_binary_exists') |
1957 | def test_process_check_binary_mudraw(self, mocked_check_binary_exists): |
1958 | @@ -157,7 +157,7 @@ |
1959 | ret = PdfController.process_check_binary('test') |
1960 | |
1961 | # THEN: mudraw should be detected |
1962 | - self.assertEqual('mudraw', ret, 'mudraw should have been detected') |
1963 | + assert 'mudraw' == ret, 'mudraw should have been detected' |
1964 | |
1965 | @patch('openlp.plugins.presentations.lib.pdfcontroller.check_binary_exists') |
1966 | def test_process_check_binary_new_motool(self, mocked_check_binary_exists): |
1967 | @@ -177,7 +177,7 @@ |
1968 | ret = PdfController.process_check_binary('test') |
1969 | |
1970 | # THEN: mutool should be detected |
1971 | - self.assertEqual('mutool', ret, 'mutool should have been detected') |
1972 | + assert 'mutool' == ret, 'mutool should have been detected' |
1973 | |
1974 | @patch('openlp.plugins.presentations.lib.pdfcontroller.check_binary_exists') |
1975 | def test_process_check_binary_old_motool(self, mocked_check_binary_exists): |
1976 | @@ -194,7 +194,7 @@ |
1977 | ret = PdfController.process_check_binary('test') |
1978 | |
1979 | # THEN: mutool should be detected |
1980 | - self.assertIsNone(ret, 'old mutool should not be accepted!') |
1981 | + assert ret is None, 'old mutool should not be accepted!' |
1982 | |
1983 | @patch('openlp.plugins.presentations.lib.pdfcontroller.check_binary_exists') |
1984 | def test_process_check_binary_gs(self, mocked_check_binary_exists): |
1985 | @@ -210,4 +210,4 @@ |
1986 | ret = PdfController.process_check_binary('test') |
1987 | |
1988 | # THEN: mutool should be detected |
1989 | - self.assertEqual('gs', ret, 'mutool should have been detected') |
1990 | + assert 'gs' == ret, 'mutool should have been detected' |
1991 | |
1992 | === modified file 'tests/functional/openlp_plugins/presentations/test_powerpointcontroller.py' |
1993 | --- tests/functional/openlp_plugins/presentations/test_powerpointcontroller.py 2017-10-07 07:05:07 +0000 |
1994 | +++ tests/functional/openlp_plugins/presentations/test_powerpointcontroller.py 2017-12-24 07:19:49 +0000 |
1995 | @@ -77,8 +77,7 @@ |
1996 | controller = PowerpointController(plugin=self.mock_plugin) |
1997 | |
1998 | # THEN: The name of the presentation controller should be correct |
1999 | - self.assertEqual('Powerpoint', controller.name, |
2000 | - 'The name of the presentation controller should be correct') |
2001 | + assert 'Powerpoint' == controller.name, 'The name of the presentation controller should be correct' |
2002 | |
2003 | |
2004 | class TestPowerpointDocument(TestCase, TestMixin): |
2005 | @@ -157,7 +156,7 @@ |
2006 | result = doc.is_loaded() |
2007 | |
2008 | # THEN: result should be true |
2009 | - self.assertEqual(result, True, 'The result should be True') |
2010 | + assert result is True, 'The result should be True' |
2011 | else: |
2012 | self.skipTest('Powerpoint not available, skipping test.') |
2013 | |
2014 | @@ -217,7 +216,7 @@ |
2015 | result = _get_text_from_shapes(shapes) |
2016 | |
2017 | # THEN: it should return the text |
2018 | - self.assertEqual(result, 'slideText\nslideText\n', 'result should match \'slideText\nslideText\n\'') |
2019 | + assert result == 'slideText\nslideText\n', 'result should match \'slideText\nslideText\n\'' |
2020 | |
2021 | def test_get_text_from_shapes_with_no_shapes(self): |
2022 | """ |
2023 | @@ -230,7 +229,7 @@ |
2024 | result = _get_text_from_shapes(shapes) |
2025 | |
2026 | # THEN: it should not fail but return empty string |
2027 | - self.assertEqual(result, '', 'result should be empty') |
2028 | + assert result == '', 'result should be empty' |
2029 | |
2030 | def test_goto_slide(self): |
2031 | """ |
2032 | @@ -250,7 +249,7 @@ |
2033 | doc.goto_slide(1) |
2034 | |
2035 | # THEN: next_step() should be call to try to advance to the next effect. |
2036 | - self.assertTrue(doc.next_step.called, 'next_step() should have been called!') |
2037 | + assert doc.next_step.called is True, 'next_step() should have been called!' |
2038 | |
2039 | def test_blank_screen(self): |
2040 | """ |
2041 | @@ -268,9 +267,9 @@ |
2042 | doc.blank_screen() |
2043 | |
2044 | # THEN: The view state, doc.blank_slide and doc.blank_click should have new values |
2045 | - self.assertEquals(doc.presentation.SlideShowWindow.View.State, 3, 'The View State should be 3') |
2046 | - self.assertEquals(doc.blank_slide, 2, 'doc.blank_slide should be 2 because of the PowerPoint version') |
2047 | - self.assertEquals(doc.blank_click, 3, 'doc.blank_click should be 3 because of the PowerPoint version') |
2048 | + assert doc.presentation.SlideShowWindow.View.State == 3, 'The View State should be 3' |
2049 | + assert doc.blank_slide == 2, 'doc.blank_slide should be 2 because of the PowerPoint version' |
2050 | + assert doc.blank_click == 3, 'doc.blank_click should be 3 because of the PowerPoint version' |
2051 | |
2052 | def test_unblank_screen(self): |
2053 | """ |
2054 | @@ -295,10 +294,10 @@ |
2055 | doc.unblank_screen() |
2056 | |
2057 | # THEN: The view state have new value, and several function should have been called |
2058 | - self.assertEquals(doc.presentation.SlideShowWindow.View.State, 1, 'The View State should be 1') |
2059 | - self.assertEquals(doc.presentation.SlideShowWindow.Activate.called, True, |
2060 | - 'SlideShowWindow.Activate should have been called') |
2061 | - self.assertEquals(doc.presentation.SlideShowWindow.View.GotoSlide.called, True, |
2062 | - 'View.GotoSlide should have been called because of the PowerPoint version') |
2063 | - self.assertEquals(doc.presentation.SlideShowWindow.View.GotoClick.called, True, |
2064 | - 'View.GotoClick should have been called because of the PowerPoint version') |
2065 | + assert doc.presentation.SlideShowWindow.View.State == 1, 'The View State should be 1' |
2066 | + assert doc.presentation.SlideShowWindow.Activate.called is True, \ |
2067 | + 'SlideShowWindow.Activate should have been called' |
2068 | + assert doc.presentation.SlideShowWindow.View.GotoSlide.called is True, \ |
2069 | + 'View.GotoSlide should have been called because of the PowerPoint version' |
2070 | + assert doc.presentation.SlideShowWindow.View.GotoClick.called is True, \ |
2071 | + 'View.GotoClick should have been called because of the PowerPoint version' |
2072 | |
2073 | === modified file 'tests/functional/openlp_plugins/presentations/test_pptviewcontroller.py' |
2074 | --- tests/functional/openlp_plugins/presentations/test_pptviewcontroller.py 2017-10-07 07:05:07 +0000 |
2075 | +++ tests/functional/openlp_plugins/presentations/test_pptviewcontroller.py 2017-12-24 07:19:49 +0000 |
2076 | @@ -67,8 +67,7 @@ |
2077 | controller = PptviewController(plugin=self.mock_plugin) |
2078 | |
2079 | # THEN: The name of the presentation controller should be correct |
2080 | - self.assertEqual('Powerpoint Viewer', controller.name, |
2081 | - 'The name of the presentation controller should be correct') |
2082 | + assert 'Powerpoint Viewer' == controller.name, 'The name of the presentation controller should be correct' |
2083 | |
2084 | def test_check_available(self): |
2085 | """ |
2086 | @@ -86,9 +85,9 @@ |
2087 | |
2088 | # THEN: On windows it should return True, on other platforms False |
2089 | if is_win(): |
2090 | - self.assertTrue(available, 'check_available should return True on windows.') |
2091 | + assert available is True, 'check_available should return True on windows.' |
2092 | else: |
2093 | - self.assertFalse(available, 'check_available should return False when not on windows.') |
2094 | + assert available is False, 'check_available should return False when not on windows.' |
2095 | |
2096 | |
2097 | class TestPptviewDocument(TestCase): |
2098 | @@ -165,7 +164,7 @@ |
2099 | result = instance.load_presentation() |
2100 | |
2101 | # THEN: The temp folder should be created and PptviewDocument.load_presentation should return False |
2102 | - self.assertFalse(result) |
2103 | + assert result is False |
2104 | |
2105 | def test_create_titles_and_notes(self): |
2106 | """ |
2107 | @@ -205,7 +204,7 @@ |
2108 | # THEN: File existens should have been checked, and not have been opened. |
2109 | doc.save_titles_and_notes.assert_called_once_with(None, None) |
2110 | mocked_path_exists.assert_called_with() |
2111 | - self.assertEqual(mocked_open.call_count, 0, 'There should be no calls to open a file.') |
2112 | + assert mocked_open.call_count == 0, 'There should be no calls to open a file.' |
2113 | |
2114 | def test_create_titles_and_notes_invalid_file(self): |
2115 | """ |
2116 | @@ -225,4 +224,4 @@ |
2117 | |
2118 | # THEN: |
2119 | doc.save_titles_and_notes.assert_called_once_with(None, None) |
2120 | - self.assertEqual(mocked_is_zf.call_count, 1, 'is_zipfile should have been called once') |
2121 | + assert mocked_is_zf.call_count == 1, 'is_zipfile should have been called once' |
2122 | |
2123 | === modified file 'tests/functional/openlp_plugins/presentations/test_presentationcontroller.py' |
2124 | --- tests/functional/openlp_plugins/presentations/test_presentationcontroller.py 2017-11-03 20:55:41 +0000 |
2125 | +++ tests/functional/openlp_plugins/presentations/test_presentationcontroller.py 2017-12-24 07:19:49 +0000 |
2126 | @@ -58,8 +58,8 @@ |
2127 | # WHEN: The PresentationController is created |
2128 | |
2129 | # THEN: The name of the presentation controller should be correct |
2130 | - self.assertEqual('PresentationController', self.presentation.name, |
2131 | - 'The name of the presentation controller should be correct') |
2132 | + assert 'PresentationController' == self.presentation.name, \ |
2133 | + 'The name of the presentation controller should be correct' |
2134 | |
2135 | def test_save_titles_and_notes(self): |
2136 | """ |
2137 | @@ -76,7 +76,7 @@ |
2138 | self.document.save_titles_and_notes(titles, notes) |
2139 | |
2140 | # THEN: the last call to open should have been for slideNotes2.txt |
2141 | - self.assertEqual(mocked_write_text.call_count, 3, 'There should be exactly three files written') |
2142 | + assert mocked_write_text.call_count == 3, 'There should be exactly three files written' |
2143 | mocked_write_text.assert_has_calls([call('uno\ndos'), call('one'), call('two')]) |
2144 | |
2145 | def test_save_titles_and_notes_with_None(self): |
2146 | @@ -93,7 +93,7 @@ |
2147 | self.document.save_titles_and_notes(titles, notes) |
2148 | |
2149 | # THEN: No file should have been created |
2150 | - self.assertEqual(mocked_open.call_count, 0, 'No file should be created') |
2151 | + assert mocked_open.call_count == 0, 'No file should be created' |
2152 | |
2153 | def test_get_titles_and_notes(self): |
2154 | """ |
2155 | @@ -112,11 +112,11 @@ |
2156 | result_titles, result_notes = self.document.get_titles_and_notes() |
2157 | |
2158 | # THEN: it should return two items for the titles and two empty strings for the notes |
2159 | - self.assertIs(type(result_titles), list, 'result_titles should be of type list') |
2160 | - self.assertEqual(len(result_titles), 2, 'There should be two items in the titles') |
2161 | - self.assertIs(type(result_notes), list, 'result_notes should be of type list') |
2162 | - self.assertEqual(len(result_notes), 2, 'There should be two items in the notes') |
2163 | - self.assertEqual(mocked_read_text.call_count, 3, 'Three files should be read') |
2164 | + assert type(result_titles) is list, 'result_titles should be of type list' |
2165 | + assert len(result_titles) == 2, 'There should be two items in the titles' |
2166 | + assert type(result_notes) is list, 'result_notes should be of type list' |
2167 | + assert len(result_notes) == 2, 'There should be two items in the notes' |
2168 | + assert mocked_read_text.call_count == 3, 'Three files should be read' |
2169 | |
2170 | def test_get_titles_and_notes_with_file_not_found(self): |
2171 | """ |
2172 | @@ -132,10 +132,10 @@ |
2173 | result_titles, result_notes = self.document.get_titles_and_notes() |
2174 | |
2175 | # THEN: it should return two empty lists |
2176 | - self.assertIsInstance(result_titles, list, 'result_titles should be of type list') |
2177 | - self.assertEqual(len(result_titles), 0, 'there be no titles') |
2178 | - self.assertIsInstance(result_notes, list, 'result_notes should be a list') |
2179 | - self.assertEqual(len(result_notes), 0, 'but the list should be empty') |
2180 | + assert isinstance(result_titles, list), 'result_titles should be of type list' |
2181 | + assert len(result_titles) == 0, 'there be no titles' |
2182 | + assert isinstance(result_notes, list), 'result_notes should be a list' |
2183 | + assert len(result_notes) == 0, 'but the list should be empty' |
2184 | |
2185 | def test_get_titles_and_notes_with_file_error(self): |
2186 | """ |
2187 | @@ -151,7 +151,7 @@ |
2188 | result_titles, result_notes = self.document.get_titles_and_notes() |
2189 | |
2190 | # THEN: it should return two empty lists |
2191 | - self.assertIs(type(result_titles), list, 'result_titles should be a list') |
2192 | + assert type(result_titles) is list, 'result_titles should be a list' |
2193 | |
2194 | |
2195 | class TestPresentationDocument(TestCase): |
2196 | @@ -226,4 +226,4 @@ |
2197 | result = instance.load_presentation() |
2198 | |
2199 | # THEN: load_presentation should return false |
2200 | - self.assertFalse(result, "PresentationDocument.load_presentation should return false.") |
2201 | + assert result is False, "PresentationDocument.load_presentation should return false." |
2202 | |
2203 | === modified file 'tests/functional/openlp_plugins/songs/test_db.py' |
2204 | --- tests/functional/openlp_plugins/songs/test_db.py 2017-04-25 19:52:20 +0000 |
2205 | +++ tests/functional/openlp_plugins/songs/test_db.py 2017-12-24 07:19:49 +0000 |
2206 | @@ -66,10 +66,10 @@ |
2207 | song.add_author(author) |
2208 | |
2209 | # THEN: The author should have been added with author_type=None |
2210 | - self.assertEqual(1, len(song.authors_songs)) |
2211 | - self.assertEqual("Max", song.authors_songs[0].author.first_name) |
2212 | - self.assertEqual("Mustermann", song.authors_songs[0].author.last_name) |
2213 | - self.assertIsNone(song.authors_songs[0].author_type) |
2214 | + assert 1 == len(song.authors_songs) |
2215 | + assert "Max" == song.authors_songs[0].author.first_name |
2216 | + assert "Mustermann" == song.authors_songs[0].author.last_name |
2217 | + assert song.authors_songs[0].author_type is None |
2218 | |
2219 | def test_add_author_with_type(self): |
2220 | """ |
2221 | @@ -86,10 +86,10 @@ |
2222 | song.add_author(author, AuthorType.Words) |
2223 | |
2224 | # THEN: The author should have been added with author_type=None |
2225 | - self.assertEqual(1, len(song.authors_songs)) |
2226 | - self.assertEqual("Max", song.authors_songs[0].author.first_name) |
2227 | - self.assertEqual("Mustermann", song.authors_songs[0].author.last_name) |
2228 | - self.assertEqual(AuthorType.Words, song.authors_songs[0].author_type) |
2229 | + assert 1 == len(song.authors_songs) |
2230 | + assert "Max" == song.authors_songs[0].author.first_name |
2231 | + assert "Mustermann" == song.authors_songs[0].author.last_name |
2232 | + assert AuthorType.Words == song.authors_songs[0].author_type |
2233 | |
2234 | def test_remove_author(self): |
2235 | """ |
2236 | @@ -105,7 +105,7 @@ |
2237 | song.remove_author(author) |
2238 | |
2239 | # THEN: It should have been removed |
2240 | - self.assertEqual(0, len(song.authors_songs)) |
2241 | + assert 0 == len(song.authors_songs) |
2242 | |
2243 | def test_remove_author_with_type(self): |
2244 | """ |
2245 | @@ -122,8 +122,8 @@ |
2246 | song.remove_author(author, AuthorType.Translation) |
2247 | |
2248 | # THEN: It should have been removed and the other author should still be there |
2249 | - self.assertEqual(1, len(song.authors_songs)) |
2250 | - self.assertEqual(None, song.authors_songs[0].author_type) |
2251 | + assert 1 == len(song.authors_songs) |
2252 | + assert song.authors_songs[0].author_type is None |
2253 | |
2254 | def test_get_author_type_from_translated_text(self): |
2255 | """ |
2256 | @@ -136,7 +136,7 @@ |
2257 | author_type = AuthorType.from_translated_text(author_type_name) |
2258 | |
2259 | # THEN: The type should be correct |
2260 | - self.assertEqual(author_type, AuthorType.Words) |
2261 | + assert author_type == AuthorType.Words |
2262 | |
2263 | def test_author_get_display_name(self): |
2264 | """ |
2265 | @@ -150,7 +150,7 @@ |
2266 | display_name = author.get_display_name() |
2267 | |
2268 | # THEN: It should return only the name |
2269 | - self.assertEqual("John Doe", display_name) |
2270 | + assert "John Doe" == display_name |
2271 | |
2272 | def test_author_get_display_name_with_type_words(self): |
2273 | """ |
2274 | @@ -164,7 +164,7 @@ |
2275 | display_name = author.get_display_name(AuthorType.Words) |
2276 | |
2277 | # THEN: It should return the name with the type in brackets |
2278 | - self.assertEqual("John Doe (Words)", display_name) |
2279 | + assert "John Doe (Words)" == display_name |
2280 | |
2281 | def test_author_get_display_name_with_type_translation(self): |
2282 | """ |
2283 | @@ -178,7 +178,7 @@ |
2284 | display_name = author.get_display_name(AuthorType.Translation) |
2285 | |
2286 | # THEN: It should return the name with the type in brackets |
2287 | - self.assertEqual("John Doe (Translation)", display_name) |
2288 | + assert "John Doe (Translation)" == display_name |
2289 | |
2290 | def test_add_songbooks(self): |
2291 | """ |
2292 | @@ -195,7 +195,7 @@ |
2293 | song.add_songbook_entry(songbook, "550A") |
2294 | |
2295 | # THEN: The song should have two songbook entries |
2296 | - self.assertEqual(len(song.songbook_entries), 2, 'There should be two Songbook entries.') |
2297 | + assert len(song.songbook_entries) == 2, 'There should be two Songbook entries.' |
2298 | |
2299 | def test_upgrade_old_song_db(self): |
2300 | """ |
2301 | @@ -211,8 +211,7 @@ |
2302 | updated_to_version, latest_version = upgrade_db(db_url, upgrade) |
2303 | |
2304 | # THEN: the song db should have been upgraded to the latest version |
2305 | - self.assertEqual(updated_to_version, latest_version, |
2306 | - 'The song DB should have been upgrade to the latest version') |
2307 | + assert updated_to_version == latest_version, 'The song DB should have been upgrade to the latest version' |
2308 | |
2309 | def test_upgrade_invalid_song_db(self): |
2310 | """ |
2311 | @@ -228,5 +227,4 @@ |
2312 | updated_to_version, latest_version = upgrade_db(db_url, upgrade) |
2313 | |
2314 | # THEN: the song db should have been upgraded to the latest version without errors |
2315 | - self.assertEqual(updated_to_version, latest_version, |
2316 | - 'The song DB should have been upgrade to the latest version') |
2317 | + assert updated_to_version == latest_version, 'The song DB should have been upgrade to the latest version' |
2318 | |
2319 | === modified file 'tests/functional/openlp_plugins/songs/test_editsongform.py' |
2320 | --- tests/functional/openlp_plugins/songs/test_editsongform.py 2017-10-07 07:05:07 +0000 |
2321 | +++ tests/functional/openlp_plugins/songs/test_editsongform.py 2017-12-24 07:19:49 +0000 |
2322 | @@ -64,7 +64,7 @@ |
2323 | valid = self.edit_song_form._validate_tags(tags) |
2324 | |
2325 | # THEN they should be valid |
2326 | - self.assertTrue(valid, "The tags list should be valid") |
2327 | + assert valid is True, "The tags list should be valid" |
2328 | |
2329 | def test_validate_nonmatching_tags(self): |
2330 | # Given a set of tags |
2331 | @@ -74,7 +74,7 @@ |
2332 | valid = self.edit_song_form._validate_tags(tags) |
2333 | |
2334 | # THEN they should be valid |
2335 | - self.assertTrue(valid, "The tags list should be valid") |
2336 | + assert valid is True, "The tags list should be valid" |
2337 | |
2338 | @patch('openlp.plugins.songs.forms.editsongform.set_case_insensitive_completer') |
2339 | def test_load_objects(self, mocked_set_case_insensitive_completer): |
2340 | |
2341 | === modified file 'tests/functional/openlp_plugins/songs/test_editverseform.py' |
2342 | --- tests/functional/openlp_plugins/songs/test_editverseform.py 2017-10-10 02:29:56 +0000 |
2343 | +++ tests/functional/openlp_plugins/songs/test_editverseform.py 2017-12-24 07:19:49 +0000 |
2344 | @@ -71,7 +71,7 @@ |
2345 | self.edit_verse_form.update_suggested_verse_number() |
2346 | |
2347 | # THEN the verse number must not be changed |
2348 | - self.assertEqual(3, self.edit_verse_form.verse_number_box.value(), 'The verse number should be 3') |
2349 | + assert 3 == self.edit_verse_form.verse_number_box.value(), 'The verse number should be 3' |
2350 | |
2351 | def test_on_divide_split_button_clicked(self): |
2352 | """ |
2353 | @@ -84,8 +84,8 @@ |
2354 | # WHEN the method is called |
2355 | self.edit_verse_form.on_forced_split_button_clicked() |
2356 | # THEN the verse number must not be changed |
2357 | - self.assertEqual('[--}{--]\nText\n', self.edit_verse_form.verse_text_edit.toPlainText(), |
2358 | - 'The verse number should be [--}{--]\nText\n') |
2359 | + assert '[--}{--]\nText\n' == self.edit_verse_form.verse_text_edit.toPlainText(), \ |
2360 | + 'The verse number should be [--}{--]\nText\n' |
2361 | |
2362 | def test_on_split_button_clicked(self): |
2363 | """ |
2364 | @@ -98,5 +98,5 @@ |
2365 | # WHEN the method is called |
2366 | self.edit_verse_form.on_overflow_split_button_clicked() |
2367 | # THEN the verse number must not be changed |
2368 | - self.assertEqual('[---]\nText\n', self.edit_verse_form.verse_text_edit.toPlainText(), |
2369 | - 'The verse number should be [---]\nText\n') |
2370 | + assert '[---]\nText\n' == self.edit_verse_form.verse_text_edit.toPlainText(), \ |
2371 | + 'The verse number should be [---]\nText\n' |
2372 | |
2373 | === modified file 'tests/functional/openlp_plugins/songs/test_ewimport.py' |
2374 | --- tests/functional/openlp_plugins/songs/test_ewimport.py 2017-12-22 10:45:39 +0000 |
2375 | +++ tests/functional/openlp_plugins/songs/test_ewimport.py 2017-12-24 07:19:49 +0000 |
2376 | @@ -165,11 +165,10 @@ |
2377 | field_desc_entry = FieldDescEntry(name, field_type, size) |
2378 | |
2379 | # THEN: |
2380 | - self.assertIsNotNone(field_desc_entry, 'Import should not be none') |
2381 | - self.assertEqual(field_desc_entry.name, name, 'FieldDescEntry.name should be the same as the name argument') |
2382 | - self.assertEqual(field_desc_entry.field_type, field_type, |
2383 | - 'FieldDescEntry.type should be the same as the type argument') |
2384 | - self.assertEqual(field_desc_entry.size, size, 'FieldDescEntry.size should be the same as the size argument') |
2385 | + assert field_desc_entry is not None, 'Import should not be none' |
2386 | + assert field_desc_entry.name == name, 'FieldDescEntry.name should be the same as the name argument' |
2387 | + assert field_desc_entry.field_type == field_type, 'FieldDescEntry.type should be the same as the type argument' |
2388 | + assert field_desc_entry.size == size, 'FieldDescEntry.size should be the same as the size argument' |
2389 | |
2390 | def test_create_importer(self): |
2391 | """ |
2392 | @@ -183,7 +182,7 @@ |
2393 | importer = EasyWorshipSongImport(mocked_manager, file_paths=[]) |
2394 | |
2395 | # THEN: The importer object should not be None |
2396 | - self.assertIsNotNone(importer, 'Import should not be none') |
2397 | + assert importer is not None, 'Import should not be none' |
2398 | |
2399 | def test_find_field_exists(self): |
2400 | """ |
2401 | @@ -201,7 +200,7 @@ |
2402 | for field_name in existing_fields: |
2403 | |
2404 | # THEN: The item corresponding the index returned should have the same name attribute |
2405 | - self.assertEqual(importer.field_descriptions[importer.db_find_field(field_name)].name, field_name) |
2406 | + assert importer.field_descriptions[importer.db_find_field(field_name)].name == field_name |
2407 | |
2408 | def test_find_non_existing_field(self): |
2409 | """ |
2410 | @@ -236,7 +235,7 @@ |
2411 | |
2412 | # THEN: db_set_record_struct should return None and Struct should be called with a value representing |
2413 | # the list of field descriptions |
2414 | - self.assertIsNone(return_value, 'db_set_record_struct should return None') |
2415 | + assert return_value is None, 'db_set_record_struct should return None' |
2416 | mocked_struct.Struct.assert_called_with('>50sHIB250s250s10sQ') |
2417 | |
2418 | @patch('openlp.plugins.songs.lib.importers.easyworship.SongImport') |
2419 | @@ -257,9 +256,8 @@ |
2420 | return_value = importer.db_get_field(field_index) |
2421 | |
2422 | # THEN: db_get_field should return the known results |
2423 | - self.assertEqual(return_value, result, |
2424 | - 'db_get_field should return "%s" when called with "%s"' % |
2425 | - (result, TEST_FIELDS[field_index])) |
2426 | + assert return_value == result, 'db_get_field should return "%s" when called with "%s"' % \ |
2427 | + (result, TEST_FIELDS[field_index]) |
2428 | |
2429 | @patch('openlp.plugins.songs.lib.importers.easyworship.SongImport') |
2430 | def test_get_memo_field(self, MockSongImport): |
2431 | @@ -285,7 +283,7 @@ |
2432 | |
2433 | # THEN: db_get_field should return the appropriate value with the appropriate mocked objects being |
2434 | # called |
2435 | - self.assertEqual(importer.db_get_field(field_index), get_field_result) |
2436 | + assert importer.db_get_field(field_index) == get_field_result |
2437 | for call in get_field_read_calls: |
2438 | mocked_memo_file.read.assert_any_call(call) |
2439 | for call in get_field_seek_calls: |
2440 | @@ -330,7 +328,7 @@ |
2441 | mocked_stat.return_value.st_size = 0x7FF |
2442 | |
2443 | # THEN: do_import should return None having called Path.stat() |
2444 | - self.assertIsNone(importer.do_import(), 'do_import should return None when db_size is less than 0x800') |
2445 | + assert importer.do_import() is None, 'do_import should return None when db_size is less than 0x800' |
2446 | mocked_stat.assert_called_once_with() |
2447 | |
2448 | @patch('openlp.plugins.songs.lib.importers.easyworship.SongImport') |
2449 | @@ -353,11 +351,10 @@ |
2450 | |
2451 | # THEN: do_import should return None having called closed the open files db and memo files. |
2452 | for effect in struct_unpack_return_values: |
2453 | - self.assertIsNone(importer.do_import(), 'do_import should return None when db_size is less than 0x800') |
2454 | - self.assertEqual(mocked_open().close.call_count, 2, |
2455 | - 'The open db and memo files should have been closed') |
2456 | + assert importer.do_import() is None, 'do_import should return None when db_size is less than 0x800' |
2457 | + assert mocked_open().close.call_count == 2, 'The open db and memo files should have been closed' |
2458 | mocked_open().close.reset_mock() |
2459 | - self.assertIs(mocked_open().seek.called, False, 'db_file.seek should not have been called.') |
2460 | + assert mocked_open().seek.called is False, 'db_file.seek should not have been called.' |
2461 | |
2462 | @patch('openlp.plugins.songs.lib.importers.easyworship.SongImport') |
2463 | @patch('openlp.plugins.songs.lib.importers.easyworship.Path.is_file', return_value=True) |
2464 | @@ -383,7 +380,7 @@ |
2465 | mocked_retrieve_windows_encoding.return_value = False |
2466 | |
2467 | # THEN: do_import should return None having called retrieve_windows_encoding with the correct encoding. |
2468 | - self.assertIsNone(importer.do_import(), 'do_import should return None when db_size is less than 0x800') |
2469 | + assert importer.do_import() is None, 'do_import should return None when db_size is less than 0x800' |
2470 | mocked_retrieve_windows_encoding.assert_any_call(encoding) |
2471 | |
2472 | def test_db_file_import(self): |
2473 | @@ -425,7 +422,7 @@ |
2474 | |
2475 | # THEN: do_import should return none, the song data should be as expected, and finish should have been |
2476 | # called. |
2477 | - self.assertIsNone(import_result, 'do_import should return None when it has completed') |
2478 | + assert import_result is None, 'do_import should return None when it has completed' |
2479 | for song_data in SONG_TEST_DATA: |
2480 | title = song_data['title'] |
2481 | author_calls = song_data['authors'] |
2482 | @@ -433,19 +430,18 @@ |
2483 | ccli_number = song_data['ccli_number'] |
2484 | add_verse_calls = song_data['verses'] |
2485 | verse_order_list = song_data['verse_order_list'] |
2486 | - self.assertIn(title, importer._title_assignment_list, 'title for %s should be "%s"' % (title, title)) |
2487 | + assert title in importer._title_assignment_list, 'title for %s should be "%s"' % (title, title) |
2488 | for author in author_calls: |
2489 | mocked_add_author.assert_any_call(author) |
2490 | if song_copyright: |
2491 | - self.assertEqual(importer.copyright, song_copyright) |
2492 | + assert importer.copyright == song_copyright |
2493 | if ccli_number: |
2494 | - self.assertEqual(importer.ccli_number, ccli_number, |
2495 | - 'ccli_number for %s should be %s' % (title, ccli_number)) |
2496 | + assert importer.ccli_number == ccli_number, 'ccli_number for %s should be %s' % (title, ccli_number) |
2497 | for verse_text, verse_tag in add_verse_calls: |
2498 | mocked_add_verse.assert_any_call(verse_text, verse_tag) |
2499 | if verse_order_list: |
2500 | - self.assertEqual(importer.verse_order_list, verse_order_list, |
2501 | - 'verse_order_list for %s should be %s' % (title, verse_order_list)) |
2502 | + assert importer.verse_order_list == verse_order_list, \ |
2503 | + 'verse_order_list for %s should be %s' % (title, verse_order_list) |
2504 | mocked_finish.assert_called_with() |
2505 | |
2506 | @patch('openlp.plugins.songs.lib.importers.easyworship.SongImport') |
2507 | @@ -481,8 +477,8 @@ |
2508 | # THEN: do_import should return none, the song data should be as expected, and finish should have been |
2509 | # called. |
2510 | title = EWS_SONG_TEST_DATA['title'] |
2511 | - self.assertIsNone(import_result, 'do_import should return None when it has completed') |
2512 | - self.assertIn(title, importer._title_assignment_list, 'title for should be "%s"' % title) |
2513 | + assert import_result is None, 'do_import should return None when it has completed' |
2514 | + assert title in importer._title_assignment_list, 'title for should be "%s"' % title |
2515 | mocked_add_author.assert_any_call(EWS_SONG_TEST_DATA['authors'][0]) |
2516 | for verse_text, verse_tag in EWS_SONG_TEST_DATA['verses']: |
2517 | mocked_add_verse.assert_any_call(verse_text, verse_tag) |
2518 | @@ -505,4 +501,4 @@ |
2519 | importer.set_song_import_object('Test Author', b'Det som var fr\x86n begynnelsen') |
2520 | |
2521 | # THEN: The import should fail |
2522 | - self.assertEquals(importer.entry_error_log, 'Unexpected data formatting.', 'Import should fail') |
2523 | + assert importer.entry_error_log == 'Unexpected data formatting.', 'Import should fail' |
2524 | |
2525 | === modified file 'tests/functional/openlp_plugins/songs/test_foilpresenterimport.py' |
2526 | --- tests/functional/openlp_plugins/songs/test_foilpresenterimport.py 2017-05-30 18:42:35 +0000 |
2527 | +++ tests/functional/openlp_plugins/songs/test_foilpresenterimport.py 2017-12-24 07:19:49 +0000 |
2528 | @@ -106,7 +106,7 @@ |
2529 | foil_presenter_instance = FoilPresenter(mocked_manager, mocked_song_import) |
2530 | |
2531 | # THEN: The instance should not be None |
2532 | - self.assertIsNotNone(foil_presenter_instance, 'foil_presenter instance should not be none') |
2533 | + assert foil_presenter_instance is not None, 'foil_presenter instance should not be none' |
2534 | |
2535 | def test_no_xml(self): |
2536 | """ |
2537 | @@ -122,7 +122,7 @@ |
2538 | result = foil_presenter_instance.xml_to_song(arg) |
2539 | |
2540 | # Then: xml_to_song should return False |
2541 | - self.assertEqual(result, None, 'xml_to_song should return None when called with %s' % arg) |
2542 | + assert result is None, 'xml_to_song should return None when called with %s' % arg |
2543 | |
2544 | def test_encoding_declaration_removal(self): |
2545 | """ |
2546 | @@ -169,6 +169,6 @@ |
2547 | result = foil_presenter_instance._process_lyrics(mock_foilpresenterfolie, mocked_song) |
2548 | |
2549 | # THEN: _process_lyrics should return None and the song_import log_error method should have been called once |
2550 | - self.assertIsNone(result) |
2551 | + assert result is None |
2552 | self.mocked_song_import.log_error.assert_called_once_with('Element Text', 'Translated String') |
2553 | self.process_lyrics_patcher.start() |
2554 | |
2555 | === modified file 'tests/functional/openlp_plugins/songs/test_lib.py' |
2556 | --- tests/functional/openlp_plugins/songs/test_lib.py 2017-05-17 20:06:45 +0000 |
2557 | +++ tests/functional/openlp_plugins/songs/test_lib.py 2017-12-24 07:19:49 +0000 |
2558 | @@ -63,7 +63,7 @@ |
2559 | result = clean_string(dirty_string) |
2560 | |
2561 | # THEN: The string should be cleaned up and lower-cased |
2562 | - self.assertEqual(result, 'aint gonna find you there ', 'The string should be cleaned up properly') |
2563 | + assert result == 'aint gonna find you there ', 'The string should be cleaned up properly' |
2564 | |
2565 | def test_clean_title(self): |
2566 | """ |
2567 | @@ -76,7 +76,7 @@ |
2568 | result = clean_title(dirty_string) |
2569 | |
2570 | # THEN: The string should be cleaned up |
2571 | - self.assertEqual(result, 'This is a dirty string', 'The title should be cleaned up properly: "%s"' % result) |
2572 | + assert result == 'This is a dirty string', 'The title should be cleaned up properly: "%s"' % result |
2573 | |
2574 | def test_songs_probably_equal_same_song(self): |
2575 | """ |
2576 | @@ -275,7 +275,7 @@ |
2577 | new_chord = transpose_chord(chord, 1, 'english') |
2578 | |
2579 | # THEN: The chord should be transposed up one note |
2580 | - self.assertEqual(new_chord, 'C#', 'The chord should be transposed up.') |
2581 | + assert new_chord == 'C#', 'The chord should be transposed up.' |
2582 | |
2583 | def test_transpose_chord_up_adv(self): |
2584 | """ |
2585 | @@ -288,7 +288,7 @@ |
2586 | new_chord = transpose_chord(chord, 1, 'english') |
2587 | |
2588 | # THEN: The chord should be transposed up one note |
2589 | - self.assertEqual(new_chord, '(C#/E)', 'The chord should be transposed up.') |
2590 | + assert new_chord == '(C#/E)', 'The chord should be transposed up.' |
2591 | |
2592 | def test_transpose_chord_down(self): |
2593 | """ |
2594 | @@ -301,7 +301,7 @@ |
2595 | new_chord = transpose_chord(chord, -1, 'english') |
2596 | |
2597 | # THEN: The chord should be transposed down one note |
2598 | - self.assertEqual(new_chord, 'B', 'The chord should be transposed down.') |
2599 | + assert new_chord == 'B', 'The chord should be transposed down.' |
2600 | |
2601 | def test_transpose_chord_error(self): |
2602 | """ |
2603 | @@ -314,8 +314,8 @@ |
2604 | # THEN: An exception should be raised |
2605 | with self.assertRaises(ValueError) as err: |
2606 | new_chord = transpose_chord(chord, -1, 'english') |
2607 | - self.assertEqual(err.exception.args[0], '\'T\' is not in list', |
2608 | - 'ValueError exception should have been thrown for invalid chord') |
2609 | + assert err.exception.args[0] == '\'T\' is not in list', \ |
2610 | + 'ValueError exception should have been thrown for invalid chord' |
2611 | |
2612 | @patch('openlp.plugins.songs.lib.transpose_verse') |
2613 | @patch('openlp.plugins.songs.lib.Settings') |
2614 | @@ -361,13 +361,13 @@ |
2615 | result = VerseType.translated_tag('v') |
2616 | |
2617 | # THEN: The result should be "V" |
2618 | - self.assertEqual(result, 'V', 'The result should be "V"') |
2619 | + assert result == 'V', 'The result should be "V"' |
2620 | |
2621 | # WHEN: We run the translated_tag() method with a "chorus" |
2622 | result = VerseType.translated_tag('c') |
2623 | |
2624 | # THEN: The result should be "C" |
2625 | - self.assertEqual(result, 'C', 'The result should be "C"') |
2626 | + assert result == 'C', 'The result should be "C"' |
2627 | |
2628 | def test_translated_invalid_tag(self): |
2629 | """ |
2630 | @@ -381,7 +381,7 @@ |
2631 | result = VerseType.translated_tag('z') |
2632 | |
2633 | # THEN: The result should be "O" |
2634 | - self.assertEqual(result, 'O', 'The result should be "O", but was "%s"' % result) |
2635 | + assert result == 'O', 'The result should be "O", but was "%s"' % result |
2636 | |
2637 | def test_translated_invalid_tag_with_specified_default(self): |
2638 | """ |
2639 | @@ -395,7 +395,7 @@ |
2640 | result = VerseType.translated_tag('q', VerseType.Bridge) |
2641 | |
2642 | # THEN: The result should be "B" |
2643 | - self.assertEqual(result, 'B', 'The result should be "B", but was "%s"' % result) |
2644 | + assert result == 'B', 'The result should be "B", but was "%s"' % result |
2645 | |
2646 | def test_translated_invalid_tag_with_invalid_default(self): |
2647 | """ |
2648 | @@ -409,7 +409,7 @@ |
2649 | result = VerseType.translated_tag('q', 29) |
2650 | |
2651 | # THEN: The result should be "O" |
2652 | - self.assertEqual(result, 'O', 'The result should be "O", but was "%s"' % result) |
2653 | + assert result == 'O', 'The result should be "O", but was "%s"' % result |
2654 | |
2655 | def test_translated_name(self): |
2656 | """ |
2657 | @@ -423,13 +423,13 @@ |
2658 | result = VerseType.translated_name('v') |
2659 | |
2660 | # THEN: The result should be "Verse" |
2661 | - self.assertEqual(result, 'Verse', 'The result should be "Verse"') |
2662 | + assert result == 'Verse', 'The result should be "Verse"' |
2663 | |
2664 | # WHEN: We run the translated_name() method with a "chorus" |
2665 | result = VerseType.translated_name('c') |
2666 | |
2667 | # THEN: The result should be "Chorus" |
2668 | - self.assertEqual(result, 'Chorus', 'The result should be "Chorus"') |
2669 | + assert result == 'Chorus', 'The result should be "Chorus"' |
2670 | |
2671 | def test_translated_invalid_name(self): |
2672 | """ |
2673 | @@ -443,7 +443,7 @@ |
2674 | result = VerseType.translated_name('z') |
2675 | |
2676 | # THEN: The result should be "Other" |
2677 | - self.assertEqual(result, 'Other', 'The result should be "Other", but was "%s"' % result) |
2678 | + assert result == 'Other', 'The result should be "Other", but was "%s"' % result |
2679 | |
2680 | def test_translated_invalid_name_with_specified_default(self): |
2681 | """ |
2682 | @@ -457,7 +457,7 @@ |
2683 | result = VerseType.translated_name('q', VerseType.Bridge) |
2684 | |
2685 | # THEN: The result should be "Bridge" |
2686 | - self.assertEqual(result, 'Bridge', 'The result should be "Bridge", but was "%s"' % result) |
2687 | + assert result == 'Bridge', 'The result should be "Bridge", but was "%s"' % result |
2688 | |
2689 | def test_translated_invalid_name_with_invalid_default(self): |
2690 | """ |
2691 | @@ -471,7 +471,7 @@ |
2692 | result = VerseType.translated_name('q', 29) |
2693 | |
2694 | # THEN: The result should be "Other" |
2695 | - self.assertEqual(result, 'Other', 'The result should be "Other", but was "%s"' % result) |
2696 | + assert result == 'Other', 'The result should be "Other", but was "%s"' % result |
2697 | |
2698 | def test_from_tag(self): |
2699 | """ |
2700 | @@ -485,7 +485,7 @@ |
2701 | result = VerseType.from_tag('v') |
2702 | |
2703 | # THEN: The result should be VerseType.Verse |
2704 | - self.assertEqual(result, VerseType.Verse, 'The result should be VerseType.Verse, but was "%s"' % result) |
2705 | + assert result == VerseType.Verse, 'The result should be VerseType.Verse, but was "%s"' % result |
2706 | |
2707 | def test_from_tag_with_invalid_tag(self): |
2708 | """ |
2709 | @@ -499,7 +499,7 @@ |
2710 | result = VerseType.from_tag('w') |
2711 | |
2712 | # THEN: The result should be VerseType.Other |
2713 | - self.assertEqual(result, VerseType.Other, 'The result should be VerseType.Other, but was "%s"' % result) |
2714 | + assert result == VerseType.Other, 'The result should be VerseType.Other, but was "%s"' % result |
2715 | |
2716 | def test_from_tag_with_specified_default(self): |
2717 | """ |
2718 | @@ -513,7 +513,7 @@ |
2719 | result = VerseType.from_tag('x', VerseType.Chorus) |
2720 | |
2721 | # THEN: The result should be VerseType.Chorus |
2722 | - self.assertEqual(result, VerseType.Chorus, 'The result should be VerseType.Chorus, but was "%s"' % result) |
2723 | + assert result == VerseType.Chorus, 'The result should be VerseType.Chorus, but was "%s"' % result |
2724 | |
2725 | def test_from_tag_with_invalid_intdefault(self): |
2726 | """ |
2727 | @@ -527,7 +527,7 @@ |
2728 | result = VerseType.from_tag('m', 29) |
2729 | |
2730 | # THEN: The result should be VerseType.Other |
2731 | - self.assertEqual(result, VerseType.Other, 'The result should be VerseType.Other, but was "%s"' % result) |
2732 | + assert result == VerseType.Other, 'The result should be VerseType.Other, but was "%s"' % result |
2733 | |
2734 | def test_from_tag_with_invalid_default(self): |
2735 | """ |
2736 | @@ -541,7 +541,7 @@ |
2737 | result = VerseType.from_tag('@', 'asdf') |
2738 | |
2739 | # THEN: The result should be VerseType.Other |
2740 | - self.assertEqual(result, VerseType.Other, 'The result should be VerseType.Other, but was "%s"' % result) |
2741 | + assert result == VerseType.Other, 'The result should be VerseType.Other, but was "%s"' % result |
2742 | |
2743 | def test_from_tag_with_none_default(self): |
2744 | """ |
2745 | @@ -555,7 +555,7 @@ |
2746 | result = VerseType.from_tag('m', None) |
2747 | |
2748 | # THEN: The result should be None |
2749 | - self.assertIsNone(result, 'The result should be None, but was "%s"' % result) |
2750 | + assert result is None, 'The result should be None, but was "%s"' % result |
2751 | |
2752 | @patch('openlp.plugins.songs.lib.VerseType.translated_tags', new_callable=PropertyMock, return_value=['x']) |
2753 | def test_from_loose_input_with_invalid_input(self, mocked_translated_tags): |
2754 | @@ -567,7 +567,7 @@ |
2755 | result = VerseType.from_loose_input('m', None) |
2756 | |
2757 | # THEN: The result should be None |
2758 | - self.assertIsNone(result, 'The result should be None, but was "%s"' % result) |
2759 | + assert result is None, 'The result should be None, but was "%s"' % result |
2760 | |
2761 | @patch('openlp.plugins.songs.lib.VerseType.translated_tags', new_callable=PropertyMock, return_value=['x']) |
2762 | def test_from_loose_input_with_valid_input(self, mocked_translated_tags): |
2763 | @@ -579,4 +579,4 @@ |
2764 | result = VerseType.from_loose_input('v') |
2765 | |
2766 | # THEN: The result should be a Verse |
2767 | - self.assertEqual(result, VerseType.Verse, 'The result should be a verse, but was "%s"' % result) |
2768 | + assert result == VerseType.Verse, 'The result should be a verse, but was "%s"' % result |
2769 | |
2770 | === modified file 'tests/functional/openlp_plugins/songs/test_mediaitem.py' |
2771 | --- tests/functional/openlp_plugins/songs/test_mediaitem.py 2017-10-07 07:05:07 +0000 |
2772 | +++ tests/functional/openlp_plugins/songs/test_mediaitem.py 2017-12-24 07:19:49 +0000 |
2773 | @@ -324,10 +324,9 @@ |
2774 | author_list = self.media_item.generate_footer(service_item, mock_song) |
2775 | |
2776 | # THEN: I get the following Array returned |
2777 | - self.assertEqual(service_item.raw_footer, ['My Song', 'Written by: my author', 'My copyright'], |
2778 | - 'The array should be returned correctly with a song, one author and copyright') |
2779 | - self.assertEqual(author_list, ['my author'], |
2780 | - 'The author list should be returned correctly with one author') |
2781 | + assert service_item.raw_footer == ['My Song', 'Written by: my author', 'My copyright'], \ |
2782 | + 'The array should be returned correctly with a song, one author and copyright' |
2783 | + assert author_list == ['my author'], 'The author list should be returned correctly with one author' |
2784 | |
2785 | @patch(u'openlp.plugins.songs.lib.mediaitem.Settings') |
2786 | def test_build_song_footer_one_author_hide_written_by(self, MockedSettings): |
2787 | @@ -356,11 +355,10 @@ |
2788 | author_list = self.media_item.generate_footer(service_item, mock_song) |
2789 | |
2790 | # THEN: I get the following Array returned |
2791 | - self.assertEqual(service_item.raw_footer, ['My Song', 'my author', 'My copyright'], |
2792 | - 'The array should be returned correctly with a song, one author and copyright,' |
2793 | - 'text Written by should not be part of the text.') |
2794 | - self.assertEqual(author_list, ['my author'], |
2795 | - 'The author list should be returned correctly with one author') |
2796 | + assert service_item.raw_footer == ['My Song', 'my author', 'My copyright'], \ |
2797 | + 'The array should be returned correctly with a song, one author and copyright, ' \ |
2798 | + 'text Written by should not be part of the text.' |
2799 | + assert author_list == ['my author'], 'The author list should be returned correctly with one author' |
2800 | |
2801 | def test_build_song_footer_two_authors(self): |
2802 | """ |
2803 | @@ -395,11 +393,11 @@ |
2804 | author_list = self.media_item.generate_footer(service_item, mock_song) |
2805 | |
2806 | # THEN: I get the following Array returned |
2807 | - self.assertEqual(service_item.raw_footer, ['My Song', 'Words: another author', 'Music: my author', |
2808 | - 'Translation: translator', 'My copyright'], |
2809 | - 'The array should be returned correctly with a song, two authors and copyright') |
2810 | - self.assertEqual(author_list, ['another author', 'my author', 'translator'], |
2811 | - 'The author list should be returned correctly with two authors') |
2812 | + assert service_item.raw_footer == ['My Song', 'Words: another author', 'Music: my author', |
2813 | + 'Translation: translator', 'My copyright'], \ |
2814 | + 'The array should be returned correctly with a song, two authors and copyright' |
2815 | + assert author_list == ['another author', 'my author', 'translator'], \ |
2816 | + 'The author list should be returned correctly with two authors' |
2817 | |
2818 | def test_build_song_footer_base_ccli(self): |
2819 | """ |
2820 | @@ -416,16 +414,16 @@ |
2821 | self.media_item.generate_footer(service_item, mock_song) |
2822 | |
2823 | # THEN: I get the following Array returned |
2824 | - self.assertEqual(service_item.raw_footer, ['My Song', 'My copyright', 'CCLI License: 1234'], |
2825 | - 'The array should be returned correctly with a song, an author, copyright and ccli') |
2826 | + assert service_item.raw_footer == ['My Song', 'My copyright', 'CCLI License: 1234'], \ |
2827 | + 'The array should be returned correctly with a song, an author, copyright and ccli' |
2828 | |
2829 | # WHEN: I amend the CCLI value |
2830 | Settings().setValue('core/ccli number', '4321') |
2831 | self.media_item.generate_footer(service_item, mock_song) |
2832 | |
2833 | # THEN: I would get an amended footer string |
2834 | - self.assertEqual(service_item.raw_footer, ['My Song', 'My copyright', 'CCLI License: 4321'], |
2835 | - 'The array should be returned correctly with a song, an author, copyright and amended ccli') |
2836 | + assert service_item.raw_footer == ['My Song', 'My copyright', 'CCLI License: 4321'], \ |
2837 | + 'The array should be returned correctly with a song, an author, copyright and amended ccli' |
2838 | |
2839 | def test_build_song_footer_base_songbook(self): |
2840 | """ |
2841 | @@ -451,14 +449,14 @@ |
2842 | self.media_item.generate_footer(service_item, song) |
2843 | |
2844 | # THEN: The songbook should not be in the footer |
2845 | - self.assertEqual(service_item.raw_footer, ['My Song', 'My copyright']) |
2846 | + assert service_item.raw_footer == ['My Song', 'My copyright'] |
2847 | |
2848 | # WHEN: I activate the "display songbook" option |
2849 | self.media_item.display_songbook = True |
2850 | self.media_item.generate_footer(service_item, song) |
2851 | |
2852 | # THEN: The songbook should be in the footer |
2853 | - self.assertEqual(service_item.raw_footer, ['My Song', 'My copyright', 'My songbook #12, Thy songbook #502A']) |
2854 | + assert service_item.raw_footer == ['My Song', 'My copyright', 'My songbook #12, Thy songbook #502A'] |
2855 | |
2856 | def test_build_song_footer_copyright_enabled(self): |
2857 | """ |
2858 | @@ -475,7 +473,7 @@ |
2859 | self.media_item.generate_footer(service_item, mock_song) |
2860 | |
2861 | # THEN: The copyright symbol should be in the footer |
2862 | - self.assertEqual(service_item.raw_footer, ['My Song', '© My copyright']) |
2863 | + assert service_item.raw_footer == ['My Song', '© My copyright'] |
2864 | |
2865 | def test_build_song_footer_copyright_disabled(self): |
2866 | """ |
2867 | @@ -491,7 +489,7 @@ |
2868 | self.media_item.generate_footer(service_item, mock_song) |
2869 | |
2870 | # THEN: The copyright symbol should not be in the footer |
2871 | - self.assertEqual(service_item.raw_footer, ['My Song', 'My copyright']) |
2872 | + assert service_item.raw_footer == ['My Song', 'My copyright'] |
2873 | |
2874 | def test_authors_match(self): |
2875 | """ |
2876 | @@ -517,7 +515,7 @@ |
2877 | result = self.media_item._authors_match(song, authors_str) |
2878 | |
2879 | # THEN: They should match |
2880 | - self.assertTrue(result, "Authors should match") |
2881 | + assert result is True, "Authors should match" |
2882 | |
2883 | def test_authors_dont_match(self): |
2884 | # GIVEN: A song and a string with authors |
2885 | @@ -540,7 +538,7 @@ |
2886 | result = self.media_item._authors_match(song, authors_str) |
2887 | |
2888 | # THEN: They should not match |
2889 | - self.assertFalse(result, "Authors should not match") |
2890 | + assert result is False, "Authors should not match" |
2891 | |
2892 | def test_build_remote_search(self): |
2893 | """ |
2894 | @@ -559,7 +557,7 @@ |
2895 | search_results = self.media_item.search('My Song', False) |
2896 | |
2897 | # THEN: The correct formatted results are returned |
2898 | - self.assertEqual(search_results, [[123, 'My Song', 'My alternative']]) |
2899 | + assert search_results == [[123, 'My Song', 'My alternative']] |
2900 | |
2901 | @patch('openlp.plugins.songs.lib.mediaitem.Book') |
2902 | @patch('openlp.plugins.songs.lib.mediaitem.SongBookEntry') |
2903 | @@ -590,4 +588,4 @@ |
2904 | mocked_or.assert_called_once_with('%jesus%', '%jesus%', '%jesus%', '%jesus%', '%jesus%') |
2905 | self.mocked_plugin.manager.session.query.assert_called_once_with(MockedSong) |
2906 | |
2907 | - self.assertEqual(self.mocked_plugin.manager.session.query.mock_calls[4][0], '().join().join().filter().all') |
2908 | + assert self.mocked_plugin.manager.session.query.mock_calls[4][0] == '().join().join().filter().all' |
2909 | |
2910 | === modified file 'tests/functional/openlp_plugins/songs/test_mediashout.py' |
2911 | --- tests/functional/openlp_plugins/songs/test_mediashout.py 2017-10-10 02:29:56 +0000 |
2912 | +++ tests/functional/openlp_plugins/songs/test_mediashout.py 2017-12-24 07:19:49 +0000 |
2913 | @@ -54,7 +54,7 @@ |
2914 | importer = MediaShoutImport(MagicMock(), file_path='mediashout.db') |
2915 | |
2916 | # THEN: It should not be None |
2917 | - self.assertIsNotNone(importer) |
2918 | + assert importer is not None |
2919 | |
2920 | @patch('openlp.plugins.songs.lib.importers.mediashout.pyodbc') |
2921 | def test_do_import_fails_to_connect(self, mocked_pyodbc): |
2922 | @@ -112,7 +112,7 @@ |
2923 | call('SELECT Name FROM Groups INNER JOIN SongGroups ON SongGroups.GroupId = Groups.GroupId ' |
2924 | 'WHERE SongGroups.Record = ?', 1.0) |
2925 | ] |
2926 | - self.assertEqual(expected_execute_calls, mocked_cursor.execute.call_args_list) |
2927 | + assert expected_execute_calls == mocked_cursor.execute.call_args_list |
2928 | mocked_process_song.assert_called_once_with(song, [verse], [play_order], [theme, group]) |
2929 | |
2930 | @patch('openlp.plugins.songs.lib.importers.mediashout.pyodbc') |
2931 | @@ -172,16 +172,16 @@ |
2932 | |
2933 | # THEN: It should be added to the database |
2934 | mocked_set_defaults.assert_called_once_with() |
2935 | - self.assertEqual('Amazing Grace', importer.title) |
2936 | + assert 'Amazing Grace' == importer.title |
2937 | mocked_parse_author.assert_called_once_with('William Wilberforce') |
2938 | mocked_add_copyright.assert_called_once_with('Public Domain') |
2939 | - self.assertEqual('Great old hymn', importer.comments) |
2940 | - self.assertEqual(['Grace', 'Hymns'], importer.topics) |
2941 | - self.assertEqual('Hymns', importer.song_book_name) |
2942 | - self.assertEqual('', importer.song_number) |
2943 | + assert 'Great old hymn' == importer.comments |
2944 | + assert ['Grace', 'Hymns'] == importer.topics |
2945 | + assert 'Hymns' == importer.song_book_name |
2946 | + assert '' == importer.song_number |
2947 | mocked_add_verse.assert_called_once_with( |
2948 | 'Amazing grace, how sweet the sound\nThat saved a wretch like me', 'V1') |
2949 | - self.assertEqual(['V1'], importer.verse_order_list) |
2950 | + assert ['V1'] == importer.verse_order_list |
2951 | mocked_finish.assert_called_once_with() |
2952 | |
2953 | def test_process_song_with_song_number(self): |
2954 | @@ -214,14 +214,14 @@ |
2955 | |
2956 | # THEN: It should be added to the database |
2957 | mocked_set_defaults.assert_called_once_with() |
2958 | - self.assertEqual('Amazing Grace', importer.title) |
2959 | + assert 'Amazing Grace' == importer.title |
2960 | mocked_parse_author.assert_called_once_with('William Wilberforce') |
2961 | mocked_add_copyright.assert_called_once_with('Public Domain') |
2962 | - self.assertEqual('Great old hymn', importer.comments) |
2963 | - self.assertEqual(['Grace', 'Hymns'], importer.topics) |
2964 | - self.assertEqual('Hymns', importer.song_book_name) |
2965 | - self.assertEqual('2', importer.song_number) |
2966 | + assert 'Great old hymn' == importer.comments |
2967 | + assert ['Grace', 'Hymns'] == importer.topics |
2968 | + assert 'Hymns' == importer.song_book_name |
2969 | + assert '2' == importer.song_number |
2970 | mocked_add_verse.assert_called_once_with( |
2971 | 'Amazing grace, how sweet the sound\nThat saved a wretch like me', 'V1') |
2972 | - self.assertEqual(['V1'], importer.verse_order_list) |
2973 | + assert ['V1'], importer.verse_order_list |
2974 | mocked_finish.assert_called_once_with() |
2975 | |
2976 | === modified file 'tests/functional/openlp_plugins/songs/test_openlpimporter.py' |
2977 | --- tests/functional/openlp_plugins/songs/test_openlpimporter.py 2017-10-10 02:29:56 +0000 |
2978 | +++ tests/functional/openlp_plugins/songs/test_openlpimporter.py 2017-12-24 07:19:49 +0000 |
2979 | @@ -51,7 +51,7 @@ |
2980 | importer = OpenLPSongImport(mocked_manager, file_paths=[]) |
2981 | |
2982 | # THEN: The importer object should not be None |
2983 | - self.assertIsNotNone(importer, 'Import should not be none') |
2984 | + assert importer is not None, 'Import should not be none' |
2985 | |
2986 | def test_invalid_import_source(self): |
2987 | """ |
2988 | @@ -70,6 +70,6 @@ |
2989 | importer.import_source = source |
2990 | |
2991 | # THEN: do_import should return none and the progress bar maximum should not be set. |
2992 | - self.assertIsNone(importer.do_import(), 'do_import should return None when import_source is not a list') |
2993 | - self.assertEqual(mocked_import_wizard.progress_bar.setMaximum.called, False, |
2994 | - 'setMaximum on import_wizard.progress_bar should not have been called') |
2995 | + assert importer.do_import() is None, 'do_import should return None when import_source is not a list' |
2996 | + assert mocked_import_wizard.progress_bar.setMaximum.called is False, \ |
2997 | + 'setMaximum on import_wizard.progress_bar should not have been called' |
2998 | |
2999 | === modified file 'tests/functional/openlp_plugins/songs/test_openlyricsexport.py' |
3000 | --- tests/functional/openlp_plugins/songs/test_openlyricsexport.py 2017-11-20 21:57:34 +0000 |
3001 | +++ tests/functional/openlp_plugins/songs/test_openlyricsexport.py 2017-12-24 07:19:49 +0000 |
3002 | @@ -72,9 +72,7 @@ |
3003 | ol_export.do_export() |
3004 | |
3005 | # THEN: The exporter should have created 2 files |
3006 | - self.assertTrue((self.temp_folder / |
3007 | - '{title} ({display_name}).xml'.format( |
3008 | - title=song.title, display_name=author.display_name)).exists()) |
3009 | - self.assertTrue((self.temp_folder / |
3010 | - '{title} ({display_name})-1.xml'.format( |
3011 | - title=song.title, display_name=author.display_name)).exists()) |
3012 | + assert (self.temp_folder / '{title} ({display_name}).xml'.format( |
3013 | + title=song.title, display_name=author.display_name)).exists() is True |
3014 | + assert (self.temp_folder / '{title} ({display_name})-1.xml'.format( |
3015 | + title=song.title, display_name=author.display_name)).exists() is True |
3016 | |
3017 | === modified file 'tests/functional/openlp_plugins/songs/test_openlyricsimport.py' |
3018 | --- tests/functional/openlp_plugins/songs/test_openlyricsimport.py 2017-10-10 02:29:56 +0000 |
3019 | +++ tests/functional/openlp_plugins/songs/test_openlyricsimport.py 2017-12-24 07:19:49 +0000 |
3020 | @@ -114,7 +114,7 @@ |
3021 | importer = OpenLyricsImport(mocked_manager, file_paths=[]) |
3022 | |
3023 | # THEN: The importer should be an instance of SongImport |
3024 | - self.assertIsInstance(importer, SongImport) |
3025 | + assert isinstance(importer, SongImport) |
3026 | |
3027 | def test_file_import(self): |
3028 | """ |
3029 | @@ -134,7 +134,7 @@ |
3030 | importer.do_import() |
3031 | |
3032 | # THEN: The xml_to_song() method should have been called |
3033 | - self.assertTrue(importer.open_lyrics.xml_to_song.called) |
3034 | + assert importer.open_lyrics.xml_to_song.called is True |
3035 | |
3036 | def test_process_formatting_tags(self): |
3037 | """ |
3038 | @@ -153,9 +153,8 @@ |
3039 | ol._process_formatting_tags(song_xml, False) |
3040 | |
3041 | # THEN: New tags should have been saved |
3042 | - self.assertListEqual(json.loads(json.dumps(result_tags)), |
3043 | - json.loads(str(Settings().value('formattingTags/html_tags'))), |
3044 | - 'The formatting tags should contain both the old and the new') |
3045 | + assert json.loads(json.dumps(result_tags)) == json.loads(str(Settings().value('formattingTags/html_tags'))), \ |
3046 | + 'The formatting tags should contain both the old and the new' |
3047 | |
3048 | def test_process_author(self): |
3049 | """ |
3050 | @@ -173,8 +172,8 @@ |
3051 | ol._process_authors(properties_xml, mocked_song) |
3052 | |
3053 | # THEN: add_author should have been called twice |
3054 | - self.assertEquals(mocked_song.method_calls[0][1][1], 'words+music') |
3055 | - self.assertEquals(mocked_song.method_calls[1][1][1], 'words') |
3056 | + assert mocked_song.method_calls[0][1][1] == 'words+music' |
3057 | + assert mocked_song.method_calls[1][1][1] == 'words' |
3058 | |
3059 | def test_process_songbooks(self): |
3060 | """ |
3061 | @@ -192,5 +191,5 @@ |
3062 | ol._process_songbooks(properties_xml, mocked_song) |
3063 | |
3064 | # THEN: add_songbook_entry should have been called twice |
3065 | - self.assertEquals(mocked_song.method_calls[0][1][1], '48') |
3066 | - self.assertEquals(mocked_song.method_calls[1][1][1], '445 A') |
3067 | + assert mocked_song.method_calls[0][1][1] == '48' |
3068 | + assert mocked_song.method_calls[1][1][1] == '445 A' |
3069 | |
3070 | === modified file 'tests/functional/openlp_plugins/songs/test_openoffice.py' |
3071 | --- tests/functional/openlp_plugins/songs/test_openoffice.py 2017-11-30 22:46:03 +0000 |
3072 | +++ tests/functional/openlp_plugins/songs/test_openoffice.py 2017-12-24 07:19:49 +0000 |
3073 | @@ -59,7 +59,7 @@ |
3074 | importer = OpenOfficeImport(mocked_manager, file_paths=[]) |
3075 | |
3076 | # THEN: The importer object should not be None |
3077 | - self.assertIsNotNone(importer, 'Import should not be none') |
3078 | + assert importer is not None, 'Import should not be none' |
3079 | |
3080 | @patch('openlp.plugins.songs.lib.importers.openoffice.SongImport') |
3081 | def test_close_ooo_file(self, mocked_songimport): |
3082 | @@ -76,4 +76,4 @@ |
3083 | importer.close_ooo_file() |
3084 | |
3085 | # THEN: The document attribute should be None even if an exception is raised') |
3086 | - self.assertIsNone(importer.document, 'Document should be None even if an exception is raised') |
3087 | + assert importer.document is None, 'Document should be None even if an exception is raised' |
3088 | |
3089 | === modified file 'tests/functional/openlp_plugins/songs/test_opensongimport.py' |
3090 | --- tests/functional/openlp_plugins/songs/test_opensongimport.py 2017-10-10 02:29:56 +0000 |
3091 | +++ tests/functional/openlp_plugins/songs/test_opensongimport.py 2017-12-24 07:19:49 +0000 |
3092 | @@ -87,7 +87,7 @@ |
3093 | importer = OpenSongImport(mocked_manager, file_paths=[]) |
3094 | |
3095 | # THEN: The importer object should not be None |
3096 | - self.assertIsNotNone(importer, 'Import should not be none') |
3097 | + assert importer is not None, 'Import should not be none' |
3098 | |
3099 | def test_invalid_import_source(self): |
3100 | """ |
3101 | @@ -106,9 +106,9 @@ |
3102 | importer.import_source = source |
3103 | |
3104 | # THEN: do_import should return none and the progress bar maximum should not be set. |
3105 | - self.assertIsNone(importer.do_import(), 'do_import should return None when import_source is not a list') |
3106 | - self.assertEqual(mocked_import_wizard.progress_bar.setMaximum.called, False, |
3107 | - 'setMaximum on import_wizard.progress_bar should not have been called') |
3108 | + assert importer.do_import() is None, 'do_import should return None when import_source is not a list' |
3109 | + assert mocked_import_wizard.progress_bar.setMaximum.called is False, \ |
3110 | + 'setMaximum on import_wizard.progress_bar should not have been called' |
3111 | |
3112 | def test_valid_import_source(self): |
3113 | """ |
3114 | @@ -127,6 +127,6 @@ |
3115 | |
3116 | # THEN: do_import should return none and the progress bar setMaximum should be called with the length of |
3117 | # import_source. |
3118 | - self.assertIsNone(importer.do_import(), 'do_import should return None when import_source is a list ' |
3119 | - 'and stop_import_flag is True') |
3120 | + assert importer.do_import() is None, \ |
3121 | + 'do_import should return None when import_source is a list and stop_import_flag is True' |
3122 | mocked_import_wizard.progress_bar.setMaximum.assert_called_with(len(importer.import_source)) |
3123 | |
3124 | === modified file 'tests/functional/openlp_plugins/songs/test_opsproimport.py' |
3125 | --- tests/functional/openlp_plugins/songs/test_opsproimport.py 2017-10-10 02:29:56 +0000 |
3126 | +++ tests/functional/openlp_plugins/songs/test_opsproimport.py 2017-12-24 07:19:49 +0000 |
3127 | @@ -89,7 +89,7 @@ |
3128 | importer = OPSProImport(mocked_manager, file_paths=[]) |
3129 | |
3130 | # THEN: The importer object should not be None |
3131 | - self.assertIsNotNone(importer, 'Import should not be none') |
3132 | + assert importer is not None, 'Import should not be none' |
3133 | |
3134 | @patch('openlp.plugins.songs.lib.importers.opspro.SongImport') |
3135 | def test_detect_chorus(self, mocked_songimport): |
3136 | @@ -108,8 +108,8 @@ |
3137 | # THEN: The imported data should look like expected |
3138 | result_file = open(os.path.join(TEST_PATH, 'You are so faithful.json'), 'rb') |
3139 | result_data = json.loads(result_file.read().decode()) |
3140 | - self.assertListEqual(importer.verses, _get_item(result_data, 'verses')) |
3141 | - self.assertListEqual(importer.verse_order_list_generated, _get_item(result_data, 'verse_order_list')) |
3142 | + assert importer.verses == _get_item(result_data, 'verses') |
3143 | + assert importer.verse_order_list_generated == _get_item(result_data, 'verse_order_list') |
3144 | |
3145 | @patch('openlp.plugins.songs.lib.importers.opspro.SongImport') |
3146 | def test_join_and_split(self, mocked_songimport): |
3147 | @@ -128,8 +128,8 @@ |
3148 | # THEN: The imported data should look like expected |
3149 | result_file = open(os.path.join(TEST_PATH, 'Amazing Grace.json'), 'rb') |
3150 | result_data = json.loads(result_file.read().decode()) |
3151 | - self.assertListEqual(importer.verses, _get_item(result_data, 'verses')) |
3152 | - self.assertListEqual(importer.verse_order_list_generated, _get_item(result_data, 'verse_order_list')) |
3153 | + assert importer.verses == _get_item(result_data, 'verses') |
3154 | + assert importer.verse_order_list_generated == _get_item(result_data, 'verse_order_list') |
3155 | |
3156 | @patch('openlp.plugins.songs.lib.importers.opspro.SongImport') |
3157 | def test_trans_off_tag(self, mocked_songimport): |
3158 | @@ -148,8 +148,8 @@ |
3159 | # THEN: The imported data should look like expected |
3160 | result_file = open(os.path.join(TEST_PATH, 'Amazing Grace.json'), 'rb') |
3161 | result_data = json.loads(result_file.read().decode()) |
3162 | - self.assertListEqual(importer.verses, _get_item(result_data, 'verses')) |
3163 | - self.assertListEqual(importer.verse_order_list_generated, _get_item(result_data, 'verse_order_list')) |
3164 | + assert importer.verses == _get_item(result_data, 'verses') |
3165 | + assert importer.verse_order_list_generated == _get_item(result_data, 'verse_order_list') |
3166 | |
3167 | @patch('openlp.plugins.songs.lib.importers.opspro.SongImport') |
3168 | def test_trans_tag(self, mocked_songimport): |
3169 | @@ -168,5 +168,5 @@ |
3170 | # THEN: The imported data should look like expected |
3171 | result_file = open(os.path.join(TEST_PATH, 'Amazing Grace3.json'), 'rb') |
3172 | result_data = json.loads(result_file.read().decode()) |
3173 | - self.assertListEqual(importer.verses, _get_item(result_data, 'verses')) |
3174 | - self.assertListEqual(importer.verse_order_list_generated, _get_item(result_data, 'verse_order_list')) |
3175 | + assert importer.verses == _get_item(result_data, 'verses') |
3176 | + assert importer.verse_order_list_generated == _get_item(result_data, 'verse_order_list') |
3177 | |
3178 | === modified file 'tests/functional/openlp_plugins/songs/test_songbeamerimport.py' |
3179 | --- tests/functional/openlp_plugins/songs/test_songbeamerimport.py 2017-10-10 02:29:56 +0000 |
3180 | +++ tests/functional/openlp_plugins/songs/test_songbeamerimport.py 2017-12-24 07:19:49 +0000 |
3181 | @@ -99,7 +99,7 @@ |
3182 | importer = SongBeamerImport(mocked_manager, file_paths=[]) |
3183 | |
3184 | # THEN: The importer object should not be None |
3185 | - self.assertIsNotNone(importer, 'Import should not be none') |
3186 | + assert importer is not None, 'Import should not be none' |
3187 | |
3188 | def test_invalid_import_source(self): |
3189 | """ |
3190 | @@ -115,10 +115,10 @@ |
3191 | self.importer.import_source = source |
3192 | |
3193 | # THEN: do_import should return none and the progress bar maximum should not be set. |
3194 | - self.assertIsNone(self.importer.do_import(), |
3195 | - 'do_import should return None when import_source is not a list') |
3196 | - self.assertEqual(mocked_import_wizard.progress_bar.setMaximum.called, False, |
3197 | - 'setMaxium on import_wizard.progress_bar should not have been called') |
3198 | + assert self.importer.do_import() is None, \ |
3199 | + 'do_import should return None when import_source is not a list' |
3200 | + assert mocked_import_wizard.progress_bar.setMaximum.called is False, \ |
3201 | + 'setMaxium on import_wizard.progress_bar should not have been called' |
3202 | |
3203 | def test_valid_import_source(self): |
3204 | """ |
3205 | @@ -134,8 +134,8 @@ |
3206 | |
3207 | # THEN: do_import should return none and the progress bar setMaximum should be called with the length of |
3208 | # import_source. |
3209 | - self.assertIsNone(self.importer.do_import(), |
3210 | - 'do_import should return None when import_source is a list and stop_import_flag is True') |
3211 | + assert self.importer.do_import() is None, \ |
3212 | + 'do_import should return None when import_source is a list and stop_import_flag is True' |
3213 | mocked_import_wizard.progress_bar.setMaximum.assert_called_with(len(self.importer.import_source)) |
3214 | |
3215 | def test_check_verse_marks(self): |
3216 | @@ -149,8 +149,8 @@ |
3217 | # WHEN: line is being checked for verse marks |
3218 | result = self.importer.check_verse_marks(line) |
3219 | # THEN: we should get back true and c as self.importer.current_verse_type |
3220 | - self.assertTrue(result, 'Versemark for <Refrain> should be found, value true') |
3221 | - self.assertEqual(self.importer.current_verse_type, 'c', '<Refrain> should be interpreted as <c>') |
3222 | + assert result is True, 'Versemark for <Refrain> should be found, value true' |
3223 | + assert self.importer.current_verse_type == 'c', '<Refrain> should be interpreted as <c>' |
3224 | |
3225 | # GIVEN: line with unnumbered verse-type and trailing space |
3226 | line = 'ReFrain ' |
3227 | @@ -158,8 +158,8 @@ |
3228 | # WHEN: line is being checked for verse marks |
3229 | result = self.importer.check_verse_marks(line) |
3230 | # THEN: we should get back true and c as self.importer.current_verse_type |
3231 | - self.assertTrue(result, 'Versemark for <ReFrain > should be found, value true') |
3232 | - self.assertEqual(self.importer.current_verse_type, 'c', '<ReFrain > should be interpreted as <c>') |
3233 | + assert result is True, 'Versemark for <ReFrain > should be found, value true' |
3234 | + assert self.importer.current_verse_type == 'c', '<ReFrain > should be interpreted as <c>' |
3235 | |
3236 | # GIVEN: line with numbered verse-type |
3237 | line = 'VersE 1' |
3238 | @@ -167,8 +167,8 @@ |
3239 | # WHEN: line is being checked for verse marks |
3240 | result = self.importer.check_verse_marks(line) |
3241 | # THEN: we should get back true and v1 as self.importer.current_verse_type |
3242 | - self.assertTrue(result, 'Versemark for <VersE 1> should be found, value true') |
3243 | - self.assertEqual(self.importer.current_verse_type, 'v1', u'<VersE 1> should be interpreted as <v1>') |
3244 | + assert result is True, 'Versemark for <VersE 1> should be found, value true' |
3245 | + assert self.importer.current_verse_type == 'v1', u'<VersE 1> should be interpreted as <v1>' |
3246 | |
3247 | # GIVEN: line with special unnumbered verse-mark (used in Songbeamer to allow usage of non-supported tags) |
3248 | line = '$$M=special' |
3249 | @@ -176,8 +176,8 @@ |
3250 | # WHEN: line is being checked for verse marks |
3251 | result = self.importer.check_verse_marks(line) |
3252 | # THEN: we should get back true and o as self.importer.current_verse_type |
3253 | - self.assertTrue(result, 'Versemark for <$$M=special> should be found, value true') |
3254 | - self.assertEqual(self.importer.current_verse_type, 'o', u'<$$M=special> should be interpreted as <o>') |
3255 | + assert result is True, 'Versemark for <$$M=special> should be found, value true' |
3256 | + assert self.importer.current_verse_type == 'o', u'<$$M=special> should be interpreted as <o>' |
3257 | |
3258 | # GIVEN: line with song-text with 3 words |
3259 | line = 'Jesus my saviour' |
3260 | @@ -185,9 +185,8 @@ |
3261 | # WHEN: line is being checked for verse marks |
3262 | result = self.importer.check_verse_marks(line) |
3263 | # THEN: we should get back false and none as self.importer.current_verse_type |
3264 | - self.assertFalse(result, 'No versemark for <Jesus my saviour> should be found, value false') |
3265 | - self.assertIsNone(self.importer.current_verse_type, |
3266 | - '<Jesus my saviour> should be interpreted as none versemark') |
3267 | + assert result is False, 'No versemark for <Jesus my saviour> should be found, value false' |
3268 | + assert self.importer.current_verse_type is None, '<Jesus my saviour> should be interpreted as none versemark' |
3269 | |
3270 | # GIVEN: line with song-text with 2 words |
3271 | line = 'Praise him' |
3272 | @@ -195,8 +194,8 @@ |
3273 | # WHEN: line is being checked for verse marks |
3274 | result = self.importer.check_verse_marks(line) |
3275 | # THEN: we should get back false and none as self.importer.current_verse_type |
3276 | - self.assertFalse(result, 'No versemark for <Praise him> should be found, value false') |
3277 | - self.assertIsNone(self.importer.current_verse_type, '<Praise him> should be interpreted as none versemark') |
3278 | + assert result is False, 'No versemark for <Praise him> should be found, value false' |
3279 | + assert self.importer.current_verse_type is None, '<Praise him> should be interpreted as none versemark' |
3280 | |
3281 | # GIVEN: line with only a space (could occur, nothing regular) |
3282 | line = ' ' |
3283 | @@ -204,8 +203,8 @@ |
3284 | # WHEN: line is being checked for verse marks |
3285 | result = self.importer.check_verse_marks(line) |
3286 | # THEN: we should get back false and none as self.importer.current_verse_type |
3287 | - self.assertFalse(result, 'No versemark for < > should be found, value false') |
3288 | - self.assertIsNone(self.importer.current_verse_type, '< > should be interpreted as none versemark') |
3289 | + assert result is False, 'No versemark for < > should be found, value false' |
3290 | + assert self.importer.current_verse_type is None, '< > should be interpreted as none versemark' |
3291 | |
3292 | # GIVEN: blank line (could occur, nothing regular) |
3293 | line = '' |
3294 | @@ -213,8 +212,8 @@ |
3295 | # WHEN: line is being checked for verse marks |
3296 | result = self.importer.check_verse_marks(line) |
3297 | # THEN: we should get back false and none as self.importer.current_verse_type |
3298 | - self.assertFalse(result, 'No versemark for <> should be found, value false') |
3299 | - self.assertIsNone(self.importer.current_verse_type, '<> should be interpreted as none versemark') |
3300 | + assert result is False, 'No versemark for <> should be found, value false' |
3301 | + assert self.importer.current_verse_type is None, '<> should be interpreted as none versemark' |
3302 | |
3303 | def test_verse_marks_defined_in_lowercase(self): |
3304 | """ |
3305 | @@ -223,4 +222,4 @@ |
3306 | # GIVEN: SongBeamber MarkTypes |
3307 | for tag in SongBeamerTypes.MarkTypes.keys(): |
3308 | # THEN: tag should be defined in lowercase |
3309 | - self.assertEquals(tag, tag.lower(), 'Tags should be defined in lowercase') |
3310 | + assert tag == tag.lower(), 'Tags should be defined in lowercase' |
3311 | |
3312 | === modified file 'tests/functional/openlp_plugins/songs/test_songformat.py' |
3313 | --- tests/functional/openlp_plugins/songs/test_songformat.py 2016-01-10 16:01:43 +0000 |
3314 | +++ tests/functional/openlp_plugins/songs/test_songformat.py 2017-12-24 07:19:49 +0000 |
3315 | @@ -39,8 +39,8 @@ |
3316 | # GIVEN: The SongFormat class |
3317 | # WHEN: Retrieving the format list |
3318 | # THEN: All SongFormats should be returned |
3319 | - self.assertEquals(len(SongFormat.get_format_list()), len(SongFormat.__attributes__), |
3320 | - "The returned SongFormats don't match the stored ones") |
3321 | + assert len(SongFormat.get_format_list()) == len(SongFormat.__attributes__), \ |
3322 | + "The returned SongFormats don't match the stored ones" |
3323 | |
3324 | def test_get_attributed_no_attributes(self): |
3325 | """ |
3326 | @@ -50,8 +50,8 @@ |
3327 | # WHEN: Retrieving all attributes of a SongFormat |
3328 | for song_format in SongFormat.get_format_list(): |
3329 | # THEN: All attributes associated with the SongFormat should be returned |
3330 | - self.assertEquals(SongFormat.get(song_format), SongFormat.__attributes__[song_format], |
3331 | - "The returned attributes don't match the stored ones") |
3332 | + assert SongFormat.get(song_format) == SongFormat.__attributes__[song_format], \ |
3333 | + "The returned attributes don't match the stored ones" |
3334 | |
3335 | def test_get_attributed_single_attribute(self): |
3336 | """ |
3337 | @@ -62,14 +62,14 @@ |
3338 | # WHEN: Retrieving an attribute that overrides the default values |
3339 | for attribute in SongFormat.get(song_format).keys(): |
3340 | # THEN: Return the attribute |
3341 | - self.assertEquals(SongFormat.get(song_format, attribute), SongFormat.get(song_format)[attribute], |
3342 | - "The returned attribute doesn't match the stored one") |
3343 | + assert SongFormat.get(song_format, attribute) == SongFormat.get(song_format)[attribute], \ |
3344 | + "The returned attribute doesn't match the stored one" |
3345 | # WHEN: Retrieving an attribute that was not overridden |
3346 | for attribute in SongFormat.__defaults__.keys(): |
3347 | if attribute not in SongFormat.get(song_format).keys(): |
3348 | # THEN: Return the default value |
3349 | - self.assertEquals(SongFormat.get(song_format, attribute), SongFormat.__defaults__[attribute], |
3350 | - "The returned attribute does not match the default values stored") |
3351 | + assert SongFormat.get(song_format, attribute) == SongFormat.__defaults__[attribute], \ |
3352 | + "The returned attribute does not match the default values stored" |
3353 | |
3354 | def test_get_attributed_multiple_attributes(self): |
3355 | """ |
3356 | @@ -79,9 +79,8 @@ |
3357 | # WHEN: Retrieving multiple attributes at the same time |
3358 | for song_format in SongFormat.get_format_list(): |
3359 | # THEN: Return all attributes that were specified |
3360 | - self.assertEquals(len(SongFormat.get(song_format, 'canDisable', 'availability')), 2, |
3361 | - "Did not return the correct number of attributes" |
3362 | - " when retrieving multiple attributes at once") |
3363 | + assert len(SongFormat.get(song_format, 'canDisable', 'availability')) == 2, \ |
3364 | + "Did not return the correct number of attributes when retrieving multiple attributes at once" |
3365 | |
3366 | def test_get_format_list_returns_ordered_list(self): |
3367 | """ |
3368 | @@ -91,5 +90,5 @@ |
3369 | # GIVEN: The SongFormat class |
3370 | # WHEN: Retrieving all formats |
3371 | # THEN: The returned list should be sorted according to the ordering defined in SongFormat |
3372 | - self.assertEquals(sorted(SongFormat.get_format_list()), SongFormat.get_format_list(), |
3373 | - "The list returned should be sorted according to the ordering in SongFormat") |
3374 | + assert sorted(SongFormat.get_format_list()) == SongFormat.get_format_list(), \ |
3375 | + "The list returned should be sorted according to the ordering in SongFormat" |
3376 | |
3377 | === modified file 'tests/functional/openlp_plugins/songs/test_songselect.py' |
3378 | --- tests/functional/openlp_plugins/songs/test_songselect.py 2017-10-29 06:01:25 +0000 |
3379 | +++ tests/functional/openlp_plugins/songs/test_songselect.py 2017-12-24 07:19:49 +0000 |
3380 | @@ -57,10 +57,10 @@ |
3381 | importer = SongSelectImport(None) |
3382 | |
3383 | # THEN: The object should have the correct properties |
3384 | - self.assertIsNone(importer.db_manager, 'The db_manager should be None') |
3385 | - self.assertIsNotNone(importer.html_parser, 'There should be a valid html_parser object') |
3386 | - self.assertIsNotNone(importer.opener, 'There should be a valid opener object') |
3387 | - self.assertEqual(1, mocked_build_opener.call_count, 'The build_opener method should have been called once') |
3388 | + assert importer.db_manager is None, 'The db_manager should be None' |
3389 | + assert importer.html_parser is not None, 'There should be a valid html_parser object' |
3390 | + assert importer.opener is not None, 'There should be a valid opener object' |
3391 | + assert 1 == mocked_build_opener.call_count, 'The build_opener method should have been called once' |
3392 | |
3393 | @patch('openlp.plugins.songs.lib.songselect.build_opener') |
3394 | @patch('openlp.plugins.songs.lib.songselect.BeautifulSoup') |
3395 | @@ -83,11 +83,11 @@ |
3396 | result = importer.login('username', 'password', mock_callback) |
3397 | |
3398 | # THEN: callback was called 3 times, open was called twice, find was called twice, and False was returned |
3399 | - self.assertEqual(3, mock_callback.call_count, 'callback should have been called 3 times') |
3400 | - self.assertEqual(2, mocked_login_page.find.call_count, 'find should have been called twice') |
3401 | - self.assertEqual(1, mocked_posted_page.find.call_count, 'find should have been called once') |
3402 | - self.assertEqual(2, mocked_opener.open.call_count, 'opener should have been called twice') |
3403 | - self.assertFalse(result, 'The login method should have returned False') |
3404 | + assert 3 == mock_callback.call_count, 'callback should have been called 3 times' |
3405 | + assert 2 == mocked_login_page.find.call_count, 'find should have been called twice' |
3406 | + assert 1 == mocked_posted_page.find.call_count, 'find should have been called once' |
3407 | + assert 2 == mocked_opener.open.call_count, 'opener should have been called twice' |
3408 | + assert result is False, 'The login method should have returned False' |
3409 | |
3410 | @patch('openlp.plugins.songs.lib.songselect.build_opener') |
3411 | def test_login_except(self, mocked_build_opener): |
3412 | @@ -103,8 +103,8 @@ |
3413 | result = importer.login('username', 'password', mock_callback) |
3414 | |
3415 | # THEN: callback was called 1 time and False was returned |
3416 | - self.assertEqual(1, mock_callback.call_count, 'callback should have been called 1 times') |
3417 | - self.assertFalse(result, 'The login method should have returned False') |
3418 | + assert 1 == mock_callback.call_count, 'callback should have been called 1 times' |
3419 | + assert result is False, 'The login method should have returned False' |
3420 | |
3421 | @patch('openlp.plugins.songs.lib.songselect.build_opener') |
3422 | @patch('openlp.plugins.songs.lib.songselect.BeautifulSoup') |
3423 | @@ -127,11 +127,11 @@ |
3424 | result = importer.login('username', 'password', mock_callback) |
3425 | |
3426 | # THEN: callback was called 3 times, open was called twice, find was called twice, and True was returned |
3427 | - self.assertEqual(3, mock_callback.call_count, 'callback should have been called 3 times') |
3428 | - self.assertEqual(2, mocked_login_page.find.call_count, 'find should have been called twice on the login page') |
3429 | - self.assertEqual(1, mocked_posted_page.find.call_count, 'find should have been called once on the posted page') |
3430 | - self.assertEqual(2, mocked_opener.open.call_count, 'opener should have been called twice') |
3431 | - self.assertTrue(result, 'The login method should have returned True') |
3432 | + assert 3 == mock_callback.call_count, 'callback should have been called 3 times' |
3433 | + assert 2 == mocked_login_page.find.call_count, 'find should have been called twice on the login page' |
3434 | + assert 1 == mocked_posted_page.find.call_count, 'find should have been called once on the posted page' |
3435 | + assert 2 == mocked_opener.open.call_count, 'opener should have been called twice' |
3436 | + assert result is True, 'The login method should have returned True' |
3437 | |
3438 | @patch('openlp.plugins.songs.lib.songselect.build_opener') |
3439 | @patch('openlp.plugins.songs.lib.songselect.BeautifulSoup') |
3440 | @@ -156,11 +156,11 @@ |
3441 | result = importer.login('username', 'password', mock_callback) |
3442 | |
3443 | # THEN: callback was called 3 times, open was called twice, find was called twice, and True was returned |
3444 | - self.assertEqual(3, mock_callback.call_count, 'callback should have been called 3 times') |
3445 | - self.assertEqual(2, mocked_login_page.find.call_count, 'find should have been called twice on the login page') |
3446 | - self.assertEqual(1, mocked_posted_page.find.call_count, 'find should have been called once on the posted page') |
3447 | - self.assertEqual('https://profile.ccli.com/do/login', mocked_opener.open.call_args_list[1][0][0]) |
3448 | - self.assertTrue(result, 'The login method should have returned True') |
3449 | + assert 3 == mock_callback.call_count, 'callback should have been called 3 times' |
3450 | + assert 2 == mocked_login_page.find.call_count, 'find should have been called twice on the login page' |
3451 | + assert 1 == mocked_posted_page.find.call_count, 'find should have been called once on the posted page' |
3452 | + assert 'https://profile.ccli.com/do/login', mocked_opener.open.call_args_list[1][0][0] |
3453 | + assert result is True, 'The login method should have returned True' |
3454 | |
3455 | @patch('openlp.plugins.songs.lib.songselect.build_opener') |
3456 | def test_logout(self, mocked_build_opener): |
3457 | @@ -176,7 +176,7 @@ |
3458 | importer.logout() |
3459 | |
3460 | # THEN: The opener is called once with the logout url |
3461 | - self.assertEqual(1, mocked_opener.open.call_count, 'opener should have been called once') |
3462 | + assert 1 == mocked_opener.open.call_count, 'opener should have been called once' |
3463 | mocked_opener.open.assert_called_with(LOGOUT_URL) |
3464 | |
3465 | @patch('openlp.plugins.songs.lib.songselect.build_opener') |
3466 | @@ -198,11 +198,11 @@ |
3467 | results = importer.search('text', 1000, mock_callback) |
3468 | |
3469 | # THEN: callback was never called, open was called once, find_all was called once, an empty list returned |
3470 | - self.assertEqual(0, mock_callback.call_count, 'callback should not have been called') |
3471 | - self.assertEqual(1, mocked_opener.open.call_count, 'open should have been called once') |
3472 | - self.assertEqual(1, mocked_results_page.find_all.call_count, 'find_all should have been called once') |
3473 | + assert 0 == mock_callback.call_count, 'callback should not have been called' |
3474 | + assert 1 == mocked_opener.open.call_count, 'open should have been called once' |
3475 | + assert 1 == mocked_results_page.find_all.call_count, 'find_all should have been called once' |
3476 | mocked_results_page.find_all.assert_called_with('div', 'song-result') |
3477 | - self.assertEqual([], results, 'The search method should have returned an empty list') |
3478 | + assert [] == results, 'The search method should have returned an empty list' |
3479 | |
3480 | @patch('openlp.plugins.songs.lib.songselect.build_opener') |
3481 | @patch('openlp.plugins.songs.lib.songselect.BeautifulSoup') |
3482 | @@ -238,15 +238,15 @@ |
3483 | results = importer.search('text', 1000, mock_callback) |
3484 | |
3485 | # THEN: callback was never called, open was called once, find_all was called once, an empty list returned |
3486 | - self.assertEqual(2, mock_callback.call_count, 'callback should have been called twice') |
3487 | - self.assertEqual(2, mocked_opener.open.call_count, 'open should have been called twice') |
3488 | - self.assertEqual(2, mocked_results_page.find_all.call_count, 'find_all should have been called twice') |
3489 | + assert 2 == mock_callback.call_count, 'callback should have been called twice' |
3490 | + assert 2 == mocked_opener.open.call_count, 'open should have been called twice' |
3491 | + assert 2 == mocked_results_page.find_all.call_count, 'find_all should have been called twice' |
3492 | mocked_results_page.find_all.assert_called_with('div', 'song-result') |
3493 | expected_list = [ |
3494 | {'title': 'Title 1', 'authors': ['James', 'John'], 'link': BASE_URL + '/url1'}, |
3495 | {'title': 'Title 2', 'authors': ['Philip'], 'link': BASE_URL + '/url2'} |
3496 | ] |
3497 | - self.assertListEqual(expected_list, results, 'The search method should have returned two songs') |
3498 | + assert expected_list == results, 'The search method should have returned two songs' |
3499 | |
3500 | @patch('openlp.plugins.songs.lib.songselect.build_opener') |
3501 | @patch('openlp.plugins.songs.lib.songselect.BeautifulSoup') |
3502 | @@ -289,13 +289,13 @@ |
3503 | results = importer.search('text', 2, mock_callback) |
3504 | |
3505 | # THEN: callback was called twice, open was called twice, find_all was called twice, max results returned |
3506 | - self.assertEqual(2, mock_callback.call_count, 'callback should have been called twice') |
3507 | - self.assertEqual(2, mocked_opener.open.call_count, 'open should have been called twice') |
3508 | - self.assertEqual(2, mocked_results_page.find_all.call_count, 'find_all should have been called twice') |
3509 | + assert 2 == mock_callback.call_count, 'callback should have been called twice' |
3510 | + assert 2 == mocked_opener.open.call_count, 'open should have been called twice' |
3511 | + assert 2 == mocked_results_page.find_all.call_count, 'find_all should have been called twice' |
3512 | mocked_results_page.find_all.assert_called_with('div', 'song-result') |
3513 | expected_list = [{'title': 'Title 1', 'authors': ['James', 'John'], 'link': BASE_URL + '/url1'}, |
3514 | {'title': 'Title 2', 'authors': ['Philip'], 'link': BASE_URL + '/url2'}] |
3515 | - self.assertListEqual(expected_list, results, 'The search method should have returned two songs') |
3516 | + assert expected_list == results, 'The search method should have returned two songs' |
3517 | |
3518 | @patch('openlp.plugins.songs.lib.songselect.build_opener') |
3519 | @patch('openlp.plugins.songs.lib.songselect.BeautifulSoup') |
3520 | @@ -311,7 +311,7 @@ |
3521 | importer.stop() |
3522 | |
3523 | # THEN: Searching should have stopped |
3524 | - self.assertFalse(importer.run_search, 'Searching should have been stopped') |
3525 | + assert importer.run_search is False, 'Searching should have been stopped' |
3526 | |
3527 | @patch('openlp.plugins.songs.lib.songselect.build_opener') |
3528 | def test_get_song_page_raises_exception(self, mocked_build_opener): |
3529 | @@ -330,7 +330,7 @@ |
3530 | |
3531 | # THEN: The callback should have been called once and None should be returned |
3532 | mocked_callback.assert_called_with() |
3533 | - self.assertIsNone(result, 'The get_song() method should have returned None') |
3534 | + assert result is None, 'The get_song() method should have returned None' |
3535 | |
3536 | @patch('openlp.plugins.songs.lib.songselect.build_opener') |
3537 | @patch('openlp.plugins.songs.lib.songselect.BeautifulSoup') |
3538 | @@ -347,8 +347,8 @@ |
3539 | result = importer.get_song({'link': 'link'}, callback=mocked_callback) |
3540 | |
3541 | # THEN: The callback should have been called twice and None should be returned |
3542 | - self.assertEqual(2, mocked_callback.call_count, 'The callback should have been called twice') |
3543 | - self.assertIsNone(result, 'The get_song() method should have returned None') |
3544 | + assert 2 == mocked_callback.call_count, 'The callback should have been called twice' |
3545 | + assert result is None, 'The get_song() method should have returned None' |
3546 | |
3547 | @patch('openlp.plugins.songs.lib.songselect.build_opener') |
3548 | @patch('openlp.plugins.songs.lib.songselect.BeautifulSoup') |
3549 | @@ -384,19 +384,18 @@ |
3550 | result = importer.get_song(fake_song, callback=mocked_callback) |
3551 | |
3552 | # THEN: The callback should have been called three times and the song should be returned |
3553 | - self.assertEqual(3, mocked_callback.call_count, 'The callback should have been called twice') |
3554 | - self.assertIsNotNone(result, 'The get_song() method should have returned a song dictionary') |
3555 | - self.assertEqual(2, mocked_lyrics_page.find.call_count, 'The find() method should have been called twice') |
3556 | - self.assertEqual(2, mocked_find_all.call_count, 'The find_all() method should have been called twice') |
3557 | - self.assertEqual([call('div', 'song-viewer lyrics'), call('div', 'song-viewer lyrics')], |
3558 | - mocked_lyrics_page.find.call_args_list, |
3559 | - 'The find() method should have been called with the right arguments') |
3560 | - self.assertEqual([call('p'), call('h3')], mocked_find_all.call_args_list, |
3561 | - 'The find_all() method should have been called with the right arguments') |
3562 | - self.assertIn('copyright', result, 'The returned song should have a copyright') |
3563 | - self.assertIn('ccli_number', result, 'The returned song should have a CCLI number') |
3564 | - self.assertIn('verses', result, 'The returned song should have verses') |
3565 | - self.assertEqual(3, len(result['verses']), 'Three verses should have been returned') |
3566 | + assert 3 == mocked_callback.call_count, 'The callback should have been called twice' |
3567 | + assert result is not None, 'The get_song() method should have returned a song dictionary' |
3568 | + assert 2 == mocked_lyrics_page.find.call_count, 'The find() method should have been called twice' |
3569 | + assert 2 == mocked_find_all.call_count, 'The find_all() method should have been called twice' |
3570 | + assert [call('div', 'song-viewer lyrics'), call('div', 'song-viewer lyrics')] == \ |
3571 | + mocked_lyrics_page.find.call_args_list, 'The find() method should have been called with the right arguments' |
3572 | + assert [call('p'), call('h3')] == mocked_find_all.call_args_list, \ |
3573 | + 'The find_all() method should have been called with the right arguments' |
3574 | + assert 'copyright' in result, 'The returned song should have a copyright' |
3575 | + assert 'ccli_number' in result, 'The returned song should have a CCLI number' |
3576 | + assert 'verses' in result, 'The returned song should have verses' |
3577 | + assert 3 == len(result['verses']), 'Three verses should have been returned' |
3578 | |
3579 | @patch('openlp.plugins.songs.lib.songselect.clean_song') |
3580 | @patch('openlp.plugins.songs.lib.songselect.Topic') |
3581 | @@ -427,14 +426,13 @@ |
3582 | result = importer.save_song(song_dict) |
3583 | |
3584 | # THEN: The return value should be a Song class and the mocked_db_manager should have been called |
3585 | - self.assertIsInstance(result, Song, 'The returned value should be a Song object') |
3586 | + assert isinstance(result, Song), 'The returned value should be a Song object' |
3587 | mocked_clean_song.assert_called_with(mocked_db_manager, result) |
3588 | - self.assertEqual(2, mocked_db_manager.save_object.call_count, |
3589 | - 'The save_object() method should have been called twice') |
3590 | + assert 2 == mocked_db_manager.save_object.call_count, \ |
3591 | + 'The save_object() method should have been called twice' |
3592 | mocked_db_manager.get_object_filtered.assert_called_with(MockedAuthor, False) |
3593 | - MockedAuthor.populate.assert_called_with(first_name='Public', last_name='Domain', |
3594 | - display_name='Public Domain') |
3595 | - self.assertEqual(1, len(result.authors_songs), 'There should only be one author') |
3596 | + MockedAuthor.populate.assert_called_with(first_name='Public', last_name='Domain', display_name='Public Domain') |
3597 | + assert 1 == len(result.authors_songs), 'There should only be one author' |
3598 | |
3599 | @patch('openlp.plugins.songs.lib.songselect.clean_song') |
3600 | @patch('openlp.plugins.songs.lib.songselect.Author') |
3601 | @@ -463,13 +461,13 @@ |
3602 | result = importer.save_song(song_dict) |
3603 | |
3604 | # THEN: The return value should be a Song class and the mocked_db_manager should have been called |
3605 | - self.assertIsInstance(result, Song, 'The returned value should be a Song object') |
3606 | + assert isinstance(result, Song), 'The returned value should be a Song object' |
3607 | mocked_clean_song.assert_called_with(mocked_db_manager, result) |
3608 | - self.assertEqual(2, mocked_db_manager.save_object.call_count, |
3609 | - 'The save_object() method should have been called twice') |
3610 | + assert 2 == mocked_db_manager.save_object.call_count, \ |
3611 | + 'The save_object() method should have been called twice' |
3612 | mocked_db_manager.get_object_filtered.assert_called_with(MockedAuthor, False) |
3613 | - self.assertEqual(0, MockedAuthor.populate.call_count, 'A new author should not have been instantiated') |
3614 | - self.assertEqual(1, len(result.authors_songs), 'There should only be one author') |
3615 | + assert 0 == MockedAuthor.populate.call_count, 'A new author should not have been instantiated' |
3616 | + assert 1 == len(result.authors_songs), 'There should only be one author' |
3617 | |
3618 | @patch('openlp.plugins.songs.lib.songselect.clean_song') |
3619 | @patch('openlp.plugins.songs.lib.songselect.Author') |
3620 | @@ -498,14 +496,13 @@ |
3621 | result = importer.save_song(song_dict) |
3622 | |
3623 | # THEN: The return value should be a Song class and the mocked_db_manager should have been called |
3624 | - self.assertIsInstance(result, Song, 'The returned value should be a Song object') |
3625 | + assert isinstance(result, Song), 'The returned value should be a Song object' |
3626 | mocked_clean_song.assert_called_with(mocked_db_manager, result) |
3627 | - self.assertEqual(2, mocked_db_manager.save_object.call_count, |
3628 | - 'The save_object() method should have been called twice') |
3629 | + assert 2 == mocked_db_manager.save_object.call_count, \ |
3630 | + 'The save_object() method should have been called twice' |
3631 | mocked_db_manager.get_object_filtered.assert_called_with(MockedAuthor, False) |
3632 | - MockedAuthor.populate.assert_called_with(first_name='Unknown', last_name='', |
3633 | - display_name='Unknown') |
3634 | - self.assertEqual(1, len(result.authors_songs), 'There should only be one author') |
3635 | + MockedAuthor.populate.assert_called_with(first_name='Unknown', last_name='', display_name='Unknown') |
3636 | + assert 1 == len(result.authors_songs), 'There should only be one author' |
3637 | |
3638 | |
3639 | class TestSongSelectForm(TestCase, TestMixin): |
3640 | @@ -534,8 +531,8 @@ |
3641 | ssform = SongSelectForm(None, mocked_plugin, mocked_db_manager) |
3642 | |
3643 | # THEN: The correct properties should have been assigned |
3644 | - self.assertEqual(mocked_plugin, ssform.plugin, 'The correct plugin should have been assigned') |
3645 | - self.assertEqual(mocked_db_manager, ssform.db_manager, 'The correct db_manager should have been assigned') |
3646 | + assert mocked_plugin == ssform.plugin, 'The correct plugin should have been assigned' |
3647 | + assert mocked_db_manager == ssform.db_manager, 'The correct db_manager should have been assigned' |
3648 | |
3649 | @patch('openlp.plugins.songs.forms.songselectform.SongSelectImport') |
3650 | @patch('openlp.plugins.songs.forms.songselectform.QtWidgets.QMessageBox.critical') |
3651 | @@ -570,23 +567,21 @@ |
3652 | expected_login_spacer_calls = [call(False), call(True)] |
3653 | expected_login_progress_visible_calls = [call(True), call(False)] |
3654 | expected_login_progress_value_calls = [call(0), call(0)] |
3655 | - self.assertEqual(expected_username_calls, mocked_username_edit.setEnabled.call_args_list, |
3656 | - 'The username edit should be disabled then enabled') |
3657 | - self.assertEqual(expected_password_calls, mocked_password_edit.setEnabled.call_args_list, |
3658 | - 'The password edit should be disabled then enabled') |
3659 | - self.assertEqual(expected_save_password_calls, mocked_save_password_checkbox.setEnabled.call_args_list, |
3660 | - 'The save password checkbox should be disabled then enabled') |
3661 | - self.assertEqual(expected_login_btn_calls, mocked_login_button.setEnabled.call_args_list, |
3662 | - 'The login button should be disabled then enabled') |
3663 | - self.assertEqual(expected_login_spacer_calls, mocked_login_spacer.setVisible.call_args_list, |
3664 | - 'Thee login spacer should be make invisible, then visible') |
3665 | - self.assertEqual(expected_login_progress_visible_calls, |
3666 | - mocked_login_progress_bar.setVisible.call_args_list, |
3667 | - 'Thee login progress bar should be make visible, then invisible') |
3668 | - self.assertEqual(expected_login_progress_value_calls, mocked_login_progress_bar.setValue.call_args_list, |
3669 | - 'Thee login progress bar should have the right values set') |
3670 | - self.assertEqual(2, mocked_process_events.call_count, |
3671 | - 'The process_events() method should be called twice') |
3672 | + assert expected_username_calls == mocked_username_edit.setEnabled.call_args_list, \ |
3673 | + 'The username edit should be disabled then enabled' |
3674 | + assert expected_password_calls == mocked_password_edit.setEnabled.call_args_list, \ |
3675 | + 'The password edit should be disabled then enabled' |
3676 | + assert expected_save_password_calls == mocked_save_password_checkbox.setEnabled.call_args_list, \ |
3677 | + 'The save password checkbox should be disabled then enabled' |
3678 | + assert expected_login_btn_calls == mocked_login_button.setEnabled.call_args_list, \ |
3679 | + 'The login button should be disabled then enabled' |
3680 | + assert expected_login_spacer_calls == mocked_login_spacer.setVisible.call_args_list, \ |
3681 | + 'Thee login spacer should be make invisible, then visible' |
3682 | + assert expected_login_progress_visible_calls == mocked_login_progress_bar.setVisible.call_args_list, \ |
3683 | + 'Thee login progress bar should be make visible, then invisible' |
3684 | + assert expected_login_progress_value_calls == mocked_login_progress_bar.setValue.call_args_list, \ |
3685 | + 'Thee login progress bar should have the right values set' |
3686 | + assert 2 == mocked_process_events.call_count, 'The process_events() method should be called twice' |
3687 | mocked_critical.assert_called_with(ssform, 'Error Logging In', 'There was a problem logging in, ' |
3688 | 'perhaps your username or password is ' |
3689 | 'incorrect?') |
3690 | @@ -615,7 +610,7 @@ |
3691 | 'Your song has been imported, would you like to import more songs?', |
3692 | defaultButton=QtWidgets.QMessageBox.Yes) |
3693 | mocked_on_back_button_clicked.assert_called_with() |
3694 | - self.assertIsNone(ssform.song) |
3695 | + assert ssform.song is None |
3696 | |
3697 | @patch('openlp.plugins.songs.forms.songselectform.QtWidgets.QMessageBox.question') |
3698 | @patch('openlp.plugins.songs.forms.songselectform.translate') |
3699 | @@ -641,7 +636,7 @@ |
3700 | 'Your song has been imported, would you like to import more songs?', |
3701 | defaultButton=QtWidgets.QMessageBox.Yes) |
3702 | mocked_done.assert_called_with(QtWidgets.QDialog.Accepted) |
3703 | - self.assertIsNone(ssform.song) |
3704 | + assert ssform.song is None |
3705 | |
3706 | def test_on_back_button_clicked(self): |
3707 | """ |
3708 | @@ -769,8 +764,8 @@ |
3709 | |
3710 | # THEN: The view button, search box and search button should be enabled |
3711 | mocked_song_select_importer.stop.assert_called_with() |
3712 | - self.assertTrue(ssform.search_button.isEnabled()) |
3713 | - self.assertTrue(ssform.search_combobox.isEnabled()) |
3714 | + assert ssform.search_button.isEnabled() is True |
3715 | + assert ssform.search_combobox.isEnabled() is True |
3716 | |
3717 | @patch('openlp.plugins.songs.forms.songselectform.Settings') |
3718 | @patch('openlp.plugins.songs.forms.songselectform.QtCore.QThread') |
3719 | @@ -787,8 +782,8 @@ |
3720 | ssform.on_search_button_clicked() |
3721 | |
3722 | # THEN: The search box and search button should be disabled |
3723 | - self.assertFalse(ssform.search_button.isEnabled()) |
3724 | - self.assertFalse(ssform.search_combobox.isEnabled()) |
3725 | + assert ssform.search_button.isEnabled() is False |
3726 | + assert ssform.search_combobox.isEnabled() is False |
3727 | |
3728 | def test_on_search_finished(self): |
3729 | """ |
3730 | @@ -802,8 +797,8 @@ |
3731 | ssform.on_search_finished() |
3732 | |
3733 | # THEN: The search box and search button should be enabled |
3734 | - self.assertTrue(ssform.search_button.isEnabled()) |
3735 | - self.assertTrue(ssform.search_combobox.isEnabled()) |
3736 | + assert ssform.search_button.isEnabled() is True |
3737 | + assert ssform.search_combobox.isEnabled() is True |
3738 | |
3739 | |
3740 | class TestSongSelectFileImport(SongImportTestHelper): |
3741 | @@ -839,8 +834,8 @@ |
3742 | worker = SearchWorker(importer, search_text) |
3743 | |
3744 | # THEN: The correct values should be set |
3745 | - self.assertIs(importer, worker.importer, 'The importer should be the right object') |
3746 | - self.assertEqual(search_text, worker.search_text, 'The search text should be correct') |
3747 | + assert importer is worker.importer, 'The importer should be the right object' |
3748 | + assert search_text == worker.search_text, 'The search text should be correct' |
3749 | |
3750 | def test_start(self): |
3751 | """ |
3752 | |
3753 | === modified file 'tests/functional/openlp_plugins/songs/test_songshowplusimport.py' |
3754 | --- tests/functional/openlp_plugins/songs/test_songshowplusimport.py 2017-09-30 20:16:30 +0000 |
3755 | +++ tests/functional/openlp_plugins/songs/test_songshowplusimport.py 2017-12-24 07:19:49 +0000 |
3756 | @@ -73,7 +73,7 @@ |
3757 | importer = SongShowPlusImport(mocked_manager, file_paths=[]) |
3758 | |
3759 | # THEN: The importer object should not be None |
3760 | - self.assertIsNotNone(importer, 'Import should not be none') |
3761 | + assert importer is not None, 'Import should not be none' |
3762 | |
3763 | def test_invalid_import_source(self): |
3764 | """ |
3765 | @@ -92,9 +92,9 @@ |
3766 | importer.import_source = source |
3767 | |
3768 | # THEN: do_import should return none and the progress bar maximum should not be set. |
3769 | - self.assertIsNone(importer.do_import(), 'do_import should return None when import_source is not a list') |
3770 | - self.assertEqual(mocked_import_wizard.progress_bar.setMaximum.called, False, |
3771 | - 'setMaximum on import_wizard.progress_bar should not have been called') |
3772 | + assert importer.do_import() is None, 'do_import should return None when import_source is not a list' |
3773 | + assert mocked_import_wizard.progress_bar.setMaximum.called is False, \ |
3774 | + 'setMaximum on import_wizard.progress_bar should not have been called' |
3775 | |
3776 | def test_valid_import_source(self): |
3777 | """ |
3778 | @@ -113,8 +113,8 @@ |
3779 | |
3780 | # THEN: do_import should return none and the progress bar setMaximum should be called with the length of |
3781 | # import_source. |
3782 | - self.assertIsNone(importer.do_import(), 'do_import should return None when import_source is a list ' |
3783 | - 'and stop_import_flag is True') |
3784 | + assert importer.do_import() is None, \ |
3785 | + 'do_import should return None when import_source is a list and stop_import_flag is True' |
3786 | mocked_import_wizard.progress_bar.setMaximum.assert_called_with(len(importer.import_source)) |
3787 | |
3788 | def test_to_openlp_verse_tag(self): |
3789 | @@ -141,9 +141,9 @@ |
3790 | |
3791 | # THEN: The returned value should should correlate with the input arguments |
3792 | for original_tag, openlp_tag in test_values: |
3793 | - self.assertEqual(importer.to_openlp_verse_tag(original_tag), openlp_tag, |
3794 | - 'SongShowPlusImport.to_openlp_verse_tag should return "%s" when called with "%s"' % |
3795 | - (openlp_tag, original_tag)) |
3796 | + assert importer.to_openlp_verse_tag(original_tag) == openlp_tag, \ |
3797 | + 'SongShowPlusImport.to_openlp_verse_tag should return "%s" when called with "%s"' % \ |
3798 | + (openlp_tag, original_tag) |
3799 | |
3800 | def test_to_openlp_verse_tag_verse_order(self): |
3801 | """ |
3802 | @@ -170,6 +170,6 @@ |
3803 | |
3804 | # THEN: The returned value should should correlate with the input arguments |
3805 | for original_tag, openlp_tag in test_values: |
3806 | - self.assertEqual(importer.to_openlp_verse_tag(original_tag, ignore_unique=True), openlp_tag, |
3807 | - 'SongShowPlusImport.to_openlp_verse_tag should return "%s" when called with "%s"' % |
3808 | - (openlp_tag, original_tag)) |
3809 | + assert importer.to_openlp_verse_tag(original_tag, ignore_unique=True) == openlp_tag, \ |
3810 | + 'SongShowPlusImport.to_openlp_verse_tag should return "%s" when called with "%s"' % \ |
3811 | + (openlp_tag, original_tag) |
3812 | |
3813 | === modified file 'tests/functional/openlp_plugins/songs/test_worshipcenterproimport.py' |
3814 | --- tests/functional/openlp_plugins/songs/test_worshipcenterproimport.py 2017-12-22 10:45:39 +0000 |
3815 | +++ tests/functional/openlp_plugins/songs/test_worshipcenterproimport.py 2017-12-24 07:19:49 +0000 |
3816 | @@ -156,7 +156,7 @@ |
3817 | importer = WorshipCenterProImport(mocked_manager, file_paths=[]) |
3818 | |
3819 | # THEN: The importer object should not be None |
3820 | - self.assertIsNotNone(importer, 'Import should not be none') |
3821 | + assert importer is not None, 'Import should not be none' |
3822 | |
3823 | def test_pyodbc_exception(self): |
3824 | """ |
3825 | @@ -181,7 +181,7 @@ |
3826 | return_value = importer.do_import() |
3827 | |
3828 | # THEN: do_import should return None, and pyodbc, translate & log_error are called with known calls |
3829 | - self.assertIsNone(return_value, 'do_import should return None when pyodbc raises an exception.') |
3830 | + assert return_value is None, 'do_import should return None when pyodbc raises an exception.' |
3831 | mocked_pyodbc_connect.assert_called_with('DRIVER={Microsoft Access Driver (*.mdb)};DBQ=import_source') |
3832 | mocked_translate.assert_called_with('SongsPlugin.WorshipCenterProImport', |
3833 | 'Unable to connect the WorshipCenter Pro database.') |
3834 | @@ -220,7 +220,7 @@ |
3835 | |
3836 | # THEN: do_import should return None, and pyodbc, import_wizard, importer.title and add_verse are called |
3837 | # with known calls |
3838 | - self.assertIsNone(return_value, 'do_import should return None when pyodbc raises an exception.') |
3839 | + assert return_value is None, 'do_import should return None when pyodbc raises an exception.' |
3840 | mocked_pyodbc.connect.assert_called_with('DRIVER={Microsoft Access Driver (*.mdb)};DBQ=import_source') |
3841 | mocked_pyodbc.connect().cursor.assert_any_call() |
3842 | mocked_pyodbc.connect().cursor().execute.assert_called_with('SELECT ID, Field, Value FROM __SONGDATA') |
3843 | @@ -229,8 +229,7 @@ |
3844 | add_verse_call_count = 0 |
3845 | for song_data in SONG_TEST_DATA: |
3846 | title_value = song_data['title'] |
3847 | - self.assertIn(title_value, importer._title_assignment_list, |
3848 | - 'title should have been set to %s' % title_value) |
3849 | + assert title_value in importer._title_assignment_list, 'title should have been set to %s' % title_value |
3850 | verse_calls = song_data['verses'] |
3851 | add_verse_call_count += len(verse_calls) |
3852 | for call in verse_calls: |
3853 | @@ -241,5 +240,4 @@ |
3854 | mocked_add_comment.assert_any_call(song_data['comments']) |
3855 | if 'copyright' in song_data: |
3856 | mocked_add_copyright.assert_any_call(song_data['copyright']) |
3857 | - self.assertEqual(mocked_add_verse.call_count, add_verse_call_count, |
3858 | - 'Incorrect number of calls made to add_verse') |
3859 | + assert mocked_add_verse.call_count == add_verse_call_count, 'Incorrect number of calls made to add_verse' |
3860 | |
3861 | === modified file 'tests/functional/openlp_plugins/songs/test_zionworximport.py' |
3862 | --- tests/functional/openlp_plugins/songs/test_zionworximport.py 2017-10-10 02:29:56 +0000 |
3863 | +++ tests/functional/openlp_plugins/songs/test_zionworximport.py 2017-12-24 07:19:49 +0000 |
3864 | @@ -59,7 +59,7 @@ |
3865 | importer = ZionWorxImport(mocked_manager, file_paths=[]) |
3866 | |
3867 | # THEN: The importer should be an instance of SongImport |
3868 | - self.assertIsInstance(importer, SongImport) |
3869 | + assert isinstance(importer, SongImport) |
3870 | |
3871 | |
3872 | class TestZionWorxFileImport(SongImportTestHelper): |
3873 | |
3874 | === modified file 'tests/functional/openlp_plugins/songusage/test_songusage.py' |
3875 | --- tests/functional/openlp_plugins/songusage/test_songusage.py 2017-10-10 07:08:44 +0000 |
3876 | +++ tests/functional/openlp_plugins/songusage/test_songusage.py 2017-12-24 07:19:49 +0000 |
3877 | @@ -43,10 +43,10 @@ |
3878 | # GIVEN: The SongUsagePlugin |
3879 | # WHEN: Retrieving the about text |
3880 | # THEN: about() should return a string object |
3881 | - self.assertIsInstance(SongUsagePlugin.about(), str) |
3882 | + assert isinstance(SongUsagePlugin.about(), str) |
3883 | # THEN: about() should return a non-empty string |
3884 | - self.assertNotEquals(len(SongUsagePlugin.about()), 0) |
3885 | - self.assertNotEquals(len(SongUsagePlugin.about()), 0) |
3886 | + assert len(SongUsagePlugin.about()) is not 0 |
3887 | + assert len(SongUsagePlugin.about()) is not 0 |
3888 | |
3889 | @patch('openlp.plugins.songusage.songusageplugin.Manager') |
3890 | def test_song_usage_init(self, MockedManager): |
3891 | @@ -62,8 +62,8 @@ |
3892 | |
3893 | # THEN: It should be initialised correctly |
3894 | MockedManager.assert_called_with('songusage', init_schema, upgrade_mod=upgrade) |
3895 | - self.assertEqual(mocked_manager, song_usage.manager) |
3896 | - self.assertFalse(song_usage.song_usage_active) |
3897 | + assert mocked_manager == song_usage.manager |
3898 | + assert song_usage.song_usage_active is False |
3899 | |
3900 | @patch('openlp.plugins.songusage.songusageplugin.Manager') |
3901 | def test_check_pre_conditions(self, MockedManager): |
3902 | @@ -80,7 +80,7 @@ |
3903 | ret = song_usage.check_pre_conditions() |
3904 | |
3905 | # THEN: It should return True |
3906 | - self.assertTrue(ret) |
3907 | + assert ret is True |
3908 | |
3909 | @patch('openlp.plugins.songusage.songusageplugin.Manager') |
3910 | def test_toggle_song_usage_state(self, MockedManager): |
3911 | @@ -96,4 +96,4 @@ |
3912 | song_usage.toggle_song_usage_state() |
3913 | |
3914 | # THEN: song_usage_state should have been toogled |
3915 | - self.assertFalse(song_usage.song_usage_active) |
3916 | + assert song_usage.song_usage_active is False |
3917 | |
3918 | === modified file 'tests/helpers/songfileimport.py' |
3919 | --- tests/helpers/songfileimport.py 2017-10-10 02:29:56 +0000 |
3920 | +++ tests/helpers/songfileimport.py 2017-12-24 07:19:49 +0000 |
3921 | @@ -108,7 +108,7 @@ |
3922 | verse_order_list = self._get_data(result_data, 'verse_order_list') |
3923 | |
3924 | # THEN: do_import should return none, the song data should be as expected, and finish should have been called. |
3925 | - self.assertIsNone(importer.do_import(), 'do_import should return None when it has completed') |
3926 | + assert importer.do_import() is None, 'do_import should return None when it has completed' |
3927 | |
3928 | # Debug information - will be displayed when the test fails |
3929 | log.debug("Title imported: %s" % importer.title) |
3930 | @@ -122,7 +122,7 @@ |
3931 | log.debug("Song copyright imported: %s" % importer.song_number) |
3932 | log.debug("Topics imported: %s" % importer.topics) |
3933 | |
3934 | - self.assertEqual(importer.title, title, 'title for %s should be "%s"' % (source_file_name, title)) |
3935 | + assert importer.title == title, 'title for %s should be "%s"' % (source_file_name, title) |
3936 | for author in author_calls: |
3937 | if isinstance(author, str): |
3938 | self.mocked_add_author.assert_any_call(author) |
3939 | @@ -131,27 +131,27 @@ |
3940 | if song_copyright: |
3941 | self.mocked_add_copyright.assert_called_with(song_copyright) |
3942 | if ccli_number: |
3943 | - self.assertEqual(importer.ccli_number, ccli_number, |
3944 | - 'ccli_number for %s should be %s' % (source_file_name, ccli_number)) |
3945 | + assert importer.ccli_number == ccli_number, \ |
3946 | + 'ccli_number for %s should be %s' % (source_file_name, ccli_number) |
3947 | expected_calls = [] |
3948 | for verse_text, verse_tag in add_verse_calls: |
3949 | self.mocked_add_verse.assert_any_call(verse_text, verse_tag) |
3950 | expected_calls.append(call(verse_text, verse_tag)) |
3951 | self.mocked_add_verse.assert_has_calls(expected_calls, any_order=False) |
3952 | if topics: |
3953 | - self.assertEqual(importer.topics, topics, 'topics for %s should be %s' % (source_file_name, topics)) |
3954 | + assert importer.topics == topics, 'topics for %s should be %s' % (source_file_name, topics) |
3955 | if comments: |
3956 | - self.assertEqual(importer.comments, comments, |
3957 | - 'comments for %s should be "%s"' % (source_file_name, comments)) |
3958 | + assert importer.comments == comments, \ |
3959 | + 'comments for %s should be "%s"' % (source_file_name, comments) |
3960 | if song_book_name: |
3961 | - self.assertEqual(importer.song_book_name, song_book_name, |
3962 | - 'song_book_name for %s should be "%s"' % (source_file_name, song_book_name)) |
3963 | + assert importer.song_book_name == song_book_name, \ |
3964 | + 'song_book_name for %s should be "%s"' % (source_file_name, song_book_name) |
3965 | if song_number: |
3966 | - self.assertEqual(importer.song_number, song_number, |
3967 | - 'song_number for %s should be %s' % (source_file_name, song_number)) |
3968 | + assert importer.song_number == song_number, \ |
3969 | + 'song_number for %s should be %s' % (source_file_name, song_number) |
3970 | if verse_order_list: |
3971 | - self.assertEqual(importer.verse_order_list, verse_order_list, |
3972 | - 'verse_order_list for %s should be %s' % (source_file_name, verse_order_list)) |
3973 | + assert importer.verse_order_list == verse_order_list, \ |
3974 | + 'verse_order_list for %s should be %s' % (source_file_name, verse_order_list) |
3975 | self.mocked_finish.assert_called_with() |
3976 | |
3977 | def _get_data(self, data, key): |
3978 | |
3979 | === modified file 'tests/interfaces/openlp_core/lib/test_pluginmanager.py' |
3980 | --- tests/interfaces/openlp_core/lib/test_pluginmanager.py 2017-11-18 11:23:15 +0000 |
3981 | +++ tests/interfaces/openlp_core/lib/test_pluginmanager.py 2017-12-24 07:19:49 +0000 |
3982 | @@ -86,11 +86,11 @@ |
3983 | |
3984 | # THEN: We should find the "Songs", "Bibles", etc in the plugins list |
3985 | plugin_names = [plugin.name for plugin in plugin_manager.plugins] |
3986 | - self.assertIn('songs', plugin_names, 'There should be a "songs" plugin') |
3987 | - self.assertIn('bibles', plugin_names, 'There should be a "bibles" plugin') |
3988 | - self.assertIn('presentations', plugin_names, 'There should be a "presentations" plugin') |
3989 | - self.assertIn('images', plugin_names, 'There should be a "images" plugin') |
3990 | - self.assertIn('media', plugin_names, 'There should be a "media" plugin') |
3991 | - self.assertIn('custom', plugin_names, 'There should be a "custom" plugin') |
3992 | - self.assertIn('songusage', plugin_names, 'There should be a "songusage" plugin') |
3993 | - self.assertIn('alerts', plugin_names, 'There should be a "alerts" plugin') |
3994 | + assert 'songs' in plugin_names, 'There should be a "songs" plugin' |
3995 | + assert 'bibles' in plugin_names, 'There should be a "bibles" plugin' |
3996 | + assert 'presentations' in plugin_names, 'There should be a "presentations" plugin' |
3997 | + assert 'images' in plugin_names, 'There should be a "images" plugin' |
3998 | + assert 'media' in plugin_names, 'There should be a "media" plugin' |
3999 | + assert 'custom' in plugin_names, 'There should be a "custom" plugin' |
4000 | + assert 'songusage'in plugin_names, 'There should be a "songusage" plugin' |
4001 | + assert 'alerts' in plugin_names, 'There should be a "alerts" plugin' |
4002 | |
4003 | === modified file 'tests/interfaces/openlp_core/ui/media/vendor/test_mediainfoWrapper.py' |
4004 | --- tests/interfaces/openlp_core/ui/media/vendor/test_mediainfoWrapper.py 2017-11-15 07:03:35 +0000 |
4005 | +++ tests/interfaces/openlp_core/ui/media/vendor/test_mediainfoWrapper.py 2017-12-24 07:19:49 +0000 |
4006 | @@ -46,5 +46,4 @@ |
4007 | results = MediaInfoWrapper.parse(full_path) |
4008 | |
4009 | # THEN you can determine the run time |
4010 | - self.assertEqual(results.tracks[0].duration, test_data[1], 'The correct duration is returned for ' + |
4011 | - test_data[0]) |
4012 | + assert results.tracks[0].duration == test_data[1], 'The correct duration is returned for ' + test_data[0] |
4013 | |
4014 | === modified file 'tests/interfaces/openlp_core/ui/test_filerenamedialog.py' |
4015 | --- tests/interfaces/openlp_core/ui/test_filerenamedialog.py 2017-10-07 07:05:07 +0000 |
4016 | +++ tests/interfaces/openlp_core/ui/test_filerenamedialog.py 2017-12-24 07:19:49 +0000 |
4017 | @@ -63,19 +63,19 @@ |
4018 | self.form.exec() |
4019 | |
4020 | # THEN: the window title is set correctly |
4021 | - self.assertEqual(self.form.windowTitle(), 'File Rename', 'The window title should be "File Rename"') |
4022 | + assert self.form.windowTitle() == 'File Rename', 'The window title should be "File Rename"' |
4023 | |
4024 | # WHEN: The form is executed with False arg |
4025 | self.form.exec(False) |
4026 | |
4027 | # THEN: the window title is set correctly |
4028 | - self.assertEqual(self.form.windowTitle(), 'File Rename', 'The window title should be "File Rename"') |
4029 | + assert self.form.windowTitle() == 'File Rename', 'The window title should be "File Rename"' |
4030 | |
4031 | # WHEN: The form is executed with True arg |
4032 | self.form.exec(True) |
4033 | |
4034 | # THEN: the window title is set correctly |
4035 | - self.assertEqual(self.form.windowTitle(), 'File Copy', 'The window title should be "File Copy"') |
4036 | + assert self.form.windowTitle() == 'File Copy', 'The window title should be "File Copy"' |
4037 | |
4038 | def test_line_edit_focus(self): |
4039 | """ |
4040 | @@ -104,4 +104,4 @@ |
4041 | |
4042 | # THEN: The text in the QLineEdit should be the same as the input string with the invalid characters filtered |
4043 | # out. |
4044 | - self.assertEqual(self.form.file_name_edit.text(), 'Invalid File Name') |
4045 | + assert self.form.file_name_edit.text() == 'Invalid File Name' |
4046 | |
4047 | === modified file 'tests/interfaces/openlp_core/ui/test_projectormanager.py' |
4048 | --- tests/interfaces/openlp_core/ui/test_projectormanager.py 2017-11-16 23:53:53 +0000 |
4049 | +++ tests/interfaces/openlp_core/ui/test_projectormanager.py 2017-12-24 07:19:49 +0000 |
4050 | @@ -70,8 +70,8 @@ |
4051 | # WHEN: we call bootstrap_initialise |
4052 | self.projector_manager.bootstrap_initialise() |
4053 | # THEN: ProjectorDB is setup |
4054 | - self.assertEqual(type(self.projector_manager.projectordb), ProjectorDB, |
4055 | - 'Initialization should have created a ProjectorDB() instance') |
4056 | + assert type(self.projector_manager.projectordb) == ProjectorDB, \ |
4057 | + 'Initialization should have created a ProjectorDB() instance' |
4058 | |
4059 | def test_bootstrap_post_set_up(self): |
4060 | """ |
4061 | @@ -85,10 +85,9 @@ |
4062 | self.projector_manager.bootstrap_post_set_up() |
4063 | |
4064 | # THEN: verify calls to retrieve saved projectors and edit page initialized |
4065 | - self.assertEqual(1, self.projector_manager._load_projectors.call_count, |
4066 | - 'Initialization should have called load_projectors()') |
4067 | - self.assertEqual(type(self.projector_manager.projector_form), ProjectorEditForm, |
4068 | - 'Initialization should have created a Projector Edit Form') |
4069 | - self.assertIs(self.projector_manager.projectordb, |
4070 | - self.projector_manager.projector_form.projectordb, |
4071 | - 'ProjectorEditForm should be using same ProjectorDB() instance as ProjectorManager') |
4072 | + assert 1 == self.projector_manager._load_projectors.call_count, \ |
4073 | + 'Initialization should have called load_projectors()' |
4074 | + assert type(self.projector_manager.projector_form) == ProjectorEditForm, \ |
4075 | + 'Initialization should have created a Projector Edit Form' |
4076 | + assert self.projector_manager.projectordb is self.projector_manager.projector_form.projectordb, \ |
4077 | + 'ProjectorEditForm should be using same ProjectorDB() instance as ProjectorManager' |
4078 | |
4079 | === modified file 'tests/interfaces/openlp_core/ui/test_projectorsourceform.py' |
4080 | --- tests/interfaces/openlp_core/ui/test_projectorsourceform.py 2017-11-15 00:19:49 +0000 |
4081 | +++ tests/interfaces/openlp_core/ui/test_projectorsourceform.py 2017-12-24 07:19:49 +0000 |
4082 | @@ -111,8 +111,7 @@ |
4083 | check = source_group(codes, PJLINK_DEFAULT_CODES) |
4084 | |
4085 | # THEN: return dictionary should match test dictionary |
4086 | - self.assertEquals(check, build_source_dict(), |
4087 | - "Source group dictionary should match test dictionary") |
4088 | + assert check == build_source_dict(), "Source group dictionary should match test dictionary" |
4089 | |
4090 | @patch.object(QDialog, 'exec') |
4091 | def test_source_select_edit_button(self, mocked_qdialog): |
4092 | @@ -130,9 +129,8 @@ |
4093 | projector = select_form.projector |
4094 | |
4095 | # THEN: Verify all 4 buttons are available |
4096 | - self.assertEquals(len(select_form.button_box.buttons()), 4, |
4097 | - 'SourceSelect dialog box should have "OK", "Cancel" ' |
4098 | - '"Rest", and "Revert" buttons available') |
4099 | + assert len(select_form.button_box.buttons()) == 4, \ |
4100 | + 'SourceSelect dialog box should have "OK", "Cancel", "Rest", and "Revert" buttons available' |
4101 | |
4102 | @patch.object(QDialog, 'exec') |
4103 | def test_source_select_noedit_button(self, mocked_qdialog): |
4104 | @@ -150,6 +148,5 @@ |
4105 | projector = select_form.projector |
4106 | |
4107 | # THEN: Verify only 2 buttons are available |
4108 | - self.assertEquals(len(select_form.button_box.buttons()), 2, |
4109 | - 'SourceSelect dialog box should only have "OK" ' |
4110 | - 'and "Cancel" buttons available') |
4111 | + assert len(select_form.button_box.buttons()) == 2, \ |
4112 | + 'SourceSelect dialog box should only have "OK" and "Cancel" buttons available' |
4113 | |
4114 | === modified file 'tests/interfaces/openlp_core/ui/test_servicemanager.py' |
4115 | --- tests/interfaces/openlp_core/ui/test_servicemanager.py 2017-10-23 22:09:57 +0000 |
4116 | +++ tests/interfaces/openlp_core/ui/test_servicemanager.py 2017-12-24 07:19:49 +0000 |
4117 | @@ -79,8 +79,8 @@ |
4118 | self.service_manager.setup_ui(self.service_manager) |
4119 | |
4120 | # THEN the count of items should be zero |
4121 | - self.assertEqual(self.service_manager.service_manager_list.topLevelItemCount(), 0, |
4122 | - 'The service manager list should be empty ') |
4123 | + assert self.service_manager.service_manager_list.topLevelItemCount() == 0, \ |
4124 | + 'The service manager list should be empty ' |
4125 | |
4126 | @patch('openlp.core.ui.servicemanager.QtWidgets.QTreeWidget.itemAt') |
4127 | @patch('openlp.core.ui.servicemanager.QtWidgets.QWidget.mapToGlobal') |
4128 | @@ -447,8 +447,8 @@ |
4129 | # THEN selection should be expanded |
4130 | selected_index = self.service_manager.service_manager_list.currentIndex() |
4131 | above_selected_index = self.service_manager.service_manager_list.indexAbove(selected_index) |
4132 | - self.assertTrue(self.service_manager.service_manager_list.isExpanded(above_selected_index), |
4133 | - 'Item should have been expanded') |
4134 | + assert self.service_manager.service_manager_list.isExpanded(above_selected_index) is True, \ |
4135 | + 'Item should have been expanded' |
4136 | self.service_manager.expanded.assert_called_once_with(song_item) |
4137 | |
4138 | def test_on_collapse_selection_with_parent_selected(self): |
4139 | @@ -468,10 +468,10 @@ |
4140 | |
4141 | # THEN selection should be expanded |
4142 | selected_index = self.service_manager.service_manager_list.currentIndex() |
4143 | - self.assertFalse(self.service_manager.service_manager_list.isExpanded(selected_index), |
4144 | - 'Item should have been collapsed') |
4145 | - self.assertTrue(self.service_manager.service_manager_list.currentItem() == song_item, |
4146 | - 'Top item should have been selected') |
4147 | + assert self.service_manager.service_manager_list.isExpanded(selected_index) is False, \ |
4148 | + 'Item should have been collapsed' |
4149 | + assert self.service_manager.service_manager_list.currentItem() == song_item, \ |
4150 | + 'Top item should have been selected' |
4151 | self.service_manager.collapsed.assert_called_once_with(song_item) |
4152 | |
4153 | def test_on_collapse_selection_with_child_selected(self): |
4154 | @@ -491,8 +491,8 @@ |
4155 | |
4156 | # THEN selection should be expanded |
4157 | selected_index = self.service_manager.service_manager_list.currentIndex() |
4158 | - self.assertFalse(self.service_manager.service_manager_list.isExpanded(selected_index), |
4159 | - 'Item should have been collapsed') |
4160 | - self.assertTrue(self.service_manager.service_manager_list.currentItem() == song_item, |
4161 | - 'Top item should have been selected') |
4162 | + assert self.service_manager.service_manager_list.isExpanded(selected_index) is False, \ |
4163 | + 'Item should have been collapsed' |
4164 | + assert self.service_manager.service_manager_list.currentItem() == song_item, \ |
4165 | + 'Top item should have been selected' |
4166 | self.service_manager.collapsed.assert_called_once_with(song_item) |
4167 | |
4168 | === modified file 'tests/interfaces/openlp_core/ui/test_servicenotedialog.py' |
4169 | --- tests/interfaces/openlp_core/ui/test_servicenotedialog.py 2017-10-07 07:05:07 +0000 |
4170 | +++ tests/interfaces/openlp_core/ui/test_servicenotedialog.py 2017-12-24 07:19:49 +0000 |
4171 | @@ -66,7 +66,7 @@ |
4172 | QtTest.QTest.mouseClick(ok_widget, QtCore.Qt.LeftButton) |
4173 | |
4174 | # THEN the following input text is returned |
4175 | - self.assertEqual(self.form.text_edit.toPlainText(), '', 'The returned text should be empty') |
4176 | + assert self.form.text_edit.toPlainText() == '', 'The returned text should be empty' |
4177 | |
4178 | # WHEN displaying the UI, having set the text and pressing enter |
4179 | text = 'OpenLP is the best worship software' |
4180 | @@ -77,7 +77,7 @@ |
4181 | QtTest.QTest.mouseClick(ok_widget, QtCore.Qt.LeftButton) |
4182 | |
4183 | # THEN the following text is returned |
4184 | - self.assertEqual(self.form.text_edit.toPlainText(), text, 'The text originally entered should still be there') |
4185 | + assert self.form.text_edit.toPlainText() == text, 'The text originally entered should still be there' |
4186 | |
4187 | # WHEN displaying the UI, having set the text and pressing enter |
4188 | self.form.text_edit.setPlainText('') |
4189 | @@ -88,4 +88,4 @@ |
4190 | QtTest.QTest.mouseClick(ok_widget, QtCore.Qt.LeftButton) |
4191 | |
4192 | # THEN the following text is returned |
4193 | - self.assertEqual(self.form.text_edit.toPlainText(), text, 'The new text should be returned') |
4194 | + assert self.form.text_edit.toPlainText() == text, 'The new text should be returned' |
4195 | |
4196 | === modified file 'tests/interfaces/openlp_core/ui/test_shortcutlistform.py' |
4197 | --- tests/interfaces/openlp_core/ui/test_shortcutlistform.py 2017-10-07 07:05:07 +0000 |
4198 | +++ tests/interfaces/openlp_core/ui/test_shortcutlistform.py 2017-12-24 07:19:49 +0000 |
4199 | @@ -67,9 +67,9 @@ |
4200 | self.form._adjust_button(button, checked, enabled, text) |
4201 | |
4202 | # THEN: The button should be changed. |
4203 | - self.assertEqual(button.text(), text, 'The text should match.') |
4204 | + assert button.text() == text, 'The text should match.' |
4205 | mocked_check_method.assert_called_once_with(True) |
4206 | - self.assertEqual(button.isEnabled(), enabled, 'The button should be disabled.') |
4207 | + assert button.isEnabled() == enabled, 'The button should be disabled.' |
4208 | |
4209 | def test_space_key_press_event(self): |
4210 | """ |
4211 | @@ -85,7 +85,7 @@ |
4212 | |
4213 | # THEN: The key should be released |
4214 | mocked_key_release_event.assert_called_with(mocked_event) |
4215 | - self.assertEqual(0, mocked_event.accept.call_count) |
4216 | + assert 0 == mocked_event.accept.call_count |
4217 | |
4218 | def test_primary_push_button_checked_key_press_event(self): |
4219 | """ |
4220 | @@ -102,7 +102,7 @@ |
4221 | |
4222 | # THEN: The key should be released |
4223 | mocked_key_release_event.assert_called_with(mocked_event) |
4224 | - self.assertEqual(0, mocked_event.accept.call_count) |
4225 | + assert 0 == mocked_event.accept.call_count |
4226 | |
4227 | def test_alternate_push_button_checked_key_press_event(self): |
4228 | """ |
4229 | @@ -119,7 +119,7 @@ |
4230 | |
4231 | # THEN: The key should be released |
4232 | mocked_key_release_event.assert_called_with(mocked_event) |
4233 | - self.assertEqual(0, mocked_event.accept.call_count) |
4234 | + assert 0 == mocked_event.accept.call_count |
4235 | |
4236 | def test_escape_key_press_event(self): |
4237 | """ |
4238 | @@ -148,7 +148,7 @@ |
4239 | self.form.on_default_radio_button_clicked(False) |
4240 | |
4241 | # THEN: The method should exit early (i.e. the rest of the methods are not called) |
4242 | - self.assertEqual(0, mocked_current_item_action.call_count) |
4243 | + assert 0 == mocked_current_item_action.call_count |
4244 | |
4245 | def test_on_default_radio_button_clicked_no_action(self): |
4246 | """ |
4247 | @@ -164,7 +164,7 @@ |
4248 | |
4249 | # THEN: The method should exit early (i.e. the rest of the methods are not called) |
4250 | mocked_current_item_action.assert_called_with() |
4251 | - self.assertEqual(0, mocked_action_shortcuts.call_count) |
4252 | + assert 0 == mocked_action_shortcuts.call_count |
4253 | |
4254 | def test_on_default_radio_button_clicked(self): |
4255 | """ |
4256 | @@ -202,7 +202,7 @@ |
4257 | self.form.on_custom_radio_button_clicked(False) |
4258 | |
4259 | # THEN: The method should exit early (i.e. the rest of the methods are not called) |
4260 | - self.assertEqual(0, mocked_current_item_action.call_count) |
4261 | + assert 0 == mocked_current_item_action.call_count |
4262 | |
4263 | def test_on_custom_radio_button_clicked(self): |
4264 | """ |
4265 | |
4266 | === modified file 'tests/interfaces/openlp_core/ui/test_starttimedialog.py' |
4267 | --- tests/interfaces/openlp_core/ui/test_starttimedialog.py 2017-10-07 07:05:07 +0000 |
4268 | +++ tests/interfaces/openlp_core/ui/test_starttimedialog.py 2017-12-24 07:19:49 +0000 |
4269 | @@ -56,28 +56,24 @@ |
4270 | """ |
4271 | Test StartTimeDialog are defaults correct |
4272 | """ |
4273 | - self.assertEqual(self.form.hour_spin_box.minimum(), 0, 'The minimum hour should stay the same as the dialog') |
4274 | - self.assertEqual(self.form.hour_spin_box.maximum(), 4, 'The maximum hour should stay the same as the dialog') |
4275 | - self.assertEqual(self.form.minute_spin_box.minimum(), 0, |
4276 | - 'The minimum minute should stay the same as the dialog') |
4277 | - self.assertEqual(self.form.minute_spin_box.maximum(), 59, |
4278 | - 'The maximum minute should stay the same as the dialog') |
4279 | - self.assertEqual(self.form.second_spin_box.minimum(), 0, |
4280 | - 'The minimum second should stay the same as the dialog') |
4281 | - self.assertEqual(self.form.second_spin_box.maximum(), 59, |
4282 | - 'The maximum second should stay the same as the dialog') |
4283 | - self.assertEqual(self.form.hour_finish_spin_box.minimum(), 0, |
4284 | - 'The minimum finish hour should stay the same as the dialog') |
4285 | - self.assertEqual(self.form.hour_finish_spin_box.maximum(), 4, |
4286 | - 'The maximum finish hour should stay the same as the dialog') |
4287 | - self.assertEqual(self.form.minute_finish_spin_box.minimum(), 0, |
4288 | - 'The minimum finish minute should stay the same as the dialog') |
4289 | - self.assertEqual(self.form.minute_finish_spin_box.maximum(), 59, |
4290 | - 'The maximum finish minute should stay the same as the dialog') |
4291 | - self.assertEqual(self.form.second_finish_spin_box.minimum(), 0, |
4292 | - 'The minimum finish second should stay the same as the dialog') |
4293 | - self.assertEqual(self.form.second_finish_spin_box.maximum(), 59, |
4294 | - 'The maximum finish second should stay the same as the dialog') |
4295 | + assert self.form.hour_spin_box.minimum() == 0, 'The minimum hour should stay the same as the dialog' |
4296 | + assert self.form.hour_spin_box.maximum() == 4, 'The maximum hour should stay the same as the dialog' |
4297 | + assert self.form.minute_spin_box.minimum() == 0, 'The minimum minute should stay the same as the dialog' |
4298 | + assert self.form.minute_spin_box.maximum() == 59, 'The maximum minute should stay the same as the dialog' |
4299 | + assert self.form.second_spin_box.minimum() == 0, 'The minimum second should stay the same as the dialog' |
4300 | + assert self.form.second_spin_box.maximum() == 59, 'The maximum second should stay the same as the dialog' |
4301 | + assert self.form.hour_finish_spin_box.minimum() == 0, \ |
4302 | + 'The minimum finish hour should stay the same as the dialog' |
4303 | + assert self.form.hour_finish_spin_box.maximum() == 4, \ |
4304 | + 'The maximum finish hour should stay the same as the dialog' |
4305 | + assert self.form.minute_finish_spin_box.minimum() == 0, \ |
4306 | + 'The minimum finish minute should stay the same as the dialog' |
4307 | + assert self.form.minute_finish_spin_box.maximum() == 59, \ |
4308 | + 'The maximum finish minute should stay the same as the dialog' |
4309 | + assert self.form.second_finish_spin_box.minimum() == 0, \ |
4310 | + 'The minimum finish second should stay the same as the dialog' |
4311 | + assert self.form.second_finish_spin_box.maximum() == 59, \ |
4312 | + 'The maximum finish second should stay the same as the dialog' |
4313 | |
4314 | def test_time_display(self): |
4315 | """ |
4316 | @@ -97,10 +93,10 @@ |
4317 | QtTest.QTest.mouseClick(ok_widget, QtCore.Qt.LeftButton) |
4318 | |
4319 | # THEN the following input values are returned |
4320 | - self.assertEqual(self.form.hour_spin_box.value(), 0) |
4321 | - self.assertEqual(self.form.minute_spin_box.value(), 1) |
4322 | - self.assertEqual(self.form.second_spin_box.value(), 1) |
4323 | - self.assertEqual(self.form.item['service_item'].start_time, 61, 'The start time should stay the same') |
4324 | + assert self.form.hour_spin_box.value() == 0 |
4325 | + assert self.form.minute_spin_box.value() == 1 |
4326 | + assert self.form.second_spin_box.value() == 1 |
4327 | + assert self.form.item['service_item'].start_time == 61, 'The start time should stay the same' |
4328 | |
4329 | # WHEN displaying the UI, changing the time to 2min 3secs and pressing enter |
4330 | self.form.item = {'service_item': mocked_serviceitem} |
4331 | @@ -112,7 +108,7 @@ |
4332 | QtTest.QTest.mouseClick(ok_widget, QtCore.Qt.LeftButton) |
4333 | |
4334 | # THEN the following values are returned |
4335 | - self.assertEqual(self.form.hour_spin_box.value(), 0) |
4336 | - self.assertEqual(self.form.minute_spin_box.value(), 2) |
4337 | - self.assertEqual(self.form.second_spin_box.value(), 3) |
4338 | - self.assertEqual(self.form.item['service_item'].start_time, 123, 'The start time should have changed') |
4339 | + assert self.form.hour_spin_box.value() == 0 |
4340 | + assert self.form.minute_spin_box.value() == 2 |
4341 | + assert self.form.second_spin_box.value() == 3 |
4342 | + assert self.form.item['service_item'].start_time == 123, 'The start time should have changed' |
4343 | |
4344 | === modified file 'tests/interfaces/openlp_core/ui/test_thememanager.py' |
4345 | --- tests/interfaces/openlp_core/ui/test_thememanager.py 2017-11-03 22:52:24 +0000 |
4346 | +++ tests/interfaces/openlp_core/ui/test_thememanager.py 2017-12-24 07:19:49 +0000 |
4347 | @@ -121,4 +121,4 @@ |
4348 | self.theme_manager.bootstrap_post_set_up() |
4349 | |
4350 | # THEN: |
4351 | - self.assertEqual(1, self.theme_manager.load_themes.call_count, "load_themes should have been called once") |
4352 | + assert 1 == self.theme_manager.load_themes.call_count, "load_themes should have been called once" |
4353 | |
4354 | === modified file 'tests/interfaces/openlp_core/widgets/test_edits.py' |
4355 | --- tests/interfaces/openlp_core/widgets/test_edits.py 2017-10-23 22:09:57 +0000 |
4356 | +++ tests/interfaces/openlp_core/widgets/test_edits.py 2017-12-24 07:19:49 +0000 |
4357 | @@ -86,8 +86,8 @@ |
4358 | |
4359 | # THEN: The first search type should be the first one in the list. The selected type should be saved in the |
4360 | # settings |
4361 | - self.assertEqual(self.search_edit.current_search_type(), SearchTypes.First, |
4362 | - "The first search type should be selected.") |
4363 | + assert self.search_edit.current_search_type() == SearchTypes.First, \ |
4364 | + "The first search type should be selected." |
4365 | self.mocked_settings().setValue.assert_called_once_with('settings_section/last used search type', 0) |
4366 | |
4367 | def test_set_current_search_type(self): |
4368 | @@ -99,11 +99,11 @@ |
4369 | result = self.search_edit.set_current_search_type(SearchTypes.Second) |
4370 | |
4371 | # THEN: |
4372 | - self.assertTrue(result, "The call should return success (True).") |
4373 | - self.assertEqual(self.search_edit.current_search_type(), SearchTypes.Second, |
4374 | - "The search type should be SearchTypes.Second") |
4375 | - self.assertEqual(self.search_edit.placeholderText(), SECOND_PLACEHOLDER_TEXT, |
4376 | - "The correct placeholder text should be 'Second Placeholder Text'.") |
4377 | + assert result is True, "The call should return success (True)." |
4378 | + assert self.search_edit.current_search_type() == SearchTypes.Second, \ |
4379 | + "The search type should be SearchTypes.Second" |
4380 | + assert self.search_edit.placeholderText() == SECOND_PLACEHOLDER_TEXT, \ |
4381 | + "The correct placeholder text should be 'Second Placeholder Text'." |
4382 | self.mocked_settings().setValue.assert_has_calls( |
4383 | [call('settings_section/last used search type', 0), call('settings_section/last used search type', 1)]) |
4384 | |
4385 | @@ -166,4 +166,4 @@ |
4386 | self.combo.addItem('test2') |
4387 | |
4388 | # THEN: The list of items should contain both strings. |
4389 | - self.assertEqual(self.combo.getItems(), ['test1', 'test2']) |
4390 | + assert self.combo.getItems() == ['test1', 'test2'] |
4391 | |
4392 | === modified file 'tests/interfaces/openlp_core/widgets/test_views.py' |
4393 | --- tests/interfaces/openlp_core/widgets/test_views.py 2017-10-23 22:09:57 +0000 |
4394 | +++ tests/interfaces/openlp_core/widgets/test_views.py 2017-12-24 07:19:49 +0000 |
4395 | @@ -64,7 +64,7 @@ |
4396 | # GIVEN: A new ListPreviewWidget instance. |
4397 | # WHEN: No SlideItem has been added yet. |
4398 | # THEN: The count of items should be zero. |
4399 | - self.assertEqual(self.preview_widget.slide_count(), 0, 'The slide list should be empty.') |
4400 | + assert self.preview_widget.slide_count() == 0, 'The slide list should be empty.' |
4401 | |
4402 | def test_initial_slide_number(self): |
4403 | """ |
4404 | @@ -73,7 +73,7 @@ |
4405 | # GIVEN: A new ListPreviewWidget instance. |
4406 | # WHEN: No SlideItem has been added yet. |
4407 | # THEN: The number of the current item should be -1. |
4408 | - self.assertEqual(self.preview_widget.current_slide_number(), -1, 'The slide number should be -1.') |
4409 | + assert self.preview_widget.current_slide_number() == -1, 'The slide number should be -1.' |
4410 | |
4411 | def test_replace_service_item(self): |
4412 | """ |
4413 | @@ -87,8 +87,8 @@ |
4414 | # WHEN: Added to the preview widget. |
4415 | self.preview_widget.replace_service_item(service_item, 1, 1) |
4416 | # THEN: The slide count and number should fit. |
4417 | - self.assertEqual(self.preview_widget.slide_count(), 2, 'The slide count should be 2.') |
4418 | - self.assertEqual(self.preview_widget.current_slide_number(), 1, 'The current slide number should be 1.') |
4419 | + assert self.preview_widget.slide_count() == 2, 'The slide count should be 2.' |
4420 | + assert self.preview_widget.current_slide_number() == 1, 'The current slide number should be 1.' |
4421 | |
4422 | def test_change_slide(self): |
4423 | """ |
4424 | @@ -103,4 +103,4 @@ |
4425 | self.preview_widget.replace_service_item(service_item, 1, 0) |
4426 | self.preview_widget.change_slide(1) |
4427 | # THEN: The current_slide_number should reflect the change. |
4428 | - self.assertEqual(self.preview_widget.current_slide_number(), 1, 'The current slide number should be 1.') |
4429 | + assert self.preview_widget.current_slide_number() == 1, 'The current slide number should be 1.' |
4430 | |
4431 | === modified file 'tests/interfaces/openlp_plugins/bibles/forms/test_bibleimportform.py' |
4432 | --- tests/interfaces/openlp_plugins/bibles/forms/test_bibleimportform.py 2017-10-07 07:05:07 +0000 |
4433 | +++ tests/interfaces/openlp_plugins/bibles/forms/test_bibleimportform.py 2017-12-24 07:19:49 +0000 |
4434 | @@ -78,7 +78,7 @@ |
4435 | self.form.on_web_update_button_clicked() |
4436 | |
4437 | # THEN: The webbible list should still be empty |
4438 | - self.assertEqual(self.form.web_bible_list, {}, 'The webbible list should be empty') |
4439 | + assert self.form.web_bible_list == {}, 'The webbible list should be empty' |
4440 | |
4441 | def test_custom_init(self): |
4442 | """ |
4443 | |
4444 | === modified file 'tests/interfaces/openlp_plugins/bibles/test_lib_http.py' |
4445 | --- tests/interfaces/openlp_plugins/bibles/test_lib_http.py 2017-10-07 07:05:07 +0000 |
4446 | +++ tests/interfaces/openlp_plugins/bibles/test_lib_http.py 2017-12-24 07:19:49 +0000 |
4447 | @@ -53,8 +53,8 @@ |
4448 | books = handler.get_books_from_http('NIV') |
4449 | |
4450 | # THEN: We should get back a valid service item |
4451 | - self.assertEqual(len(books), 66, 'The bible should not have had any books added or removed') |
4452 | - self.assertEqual(books[0], 'Genesis', 'The first bible book should be Genesis') |
4453 | + assert len(books) == 66, 'The bible should not have had any books added or removed' |
4454 | + assert books[0] == 'Genesis', 'The first bible book should be Genesis' |
4455 | |
4456 | def test_bible_gateway_extract_books_support_redirect(self): |
4457 | """ |
4458 | @@ -67,7 +67,7 @@ |
4459 | books = handler.get_books_from_http('DN1933') |
4460 | |
4461 | # THEN: We should get back a valid service item |
4462 | - self.assertEqual(len(books), 66, 'This bible should have 66 books') |
4463 | + assert len(books) == 66, 'This bible should have 66 books' |
4464 | |
4465 | def test_bible_gateway_extract_verse(self): |
4466 | """ |
4467 | @@ -80,8 +80,7 @@ |
4468 | results = handler.get_bible_chapter('NIV', 'John', 3) |
4469 | |
4470 | # THEN: We should get back a valid service item |
4471 | - self.assertEqual(len(results.verse_list), 36, |
4472 | - 'The book of John should not have had any verses added or removed') |
4473 | + assert len(results.verse_list) == 36, 'The book of John should not have had any verses added or removed' |
4474 | |
4475 | def test_bible_gateway_extract_verse_nkjv(self): |
4476 | """ |
4477 | @@ -94,8 +93,7 @@ |
4478 | results = handler.get_bible_chapter('NKJV', 'John', 3) |
4479 | |
4480 | # THEN: We should get back a valid service item |
4481 | - self.assertEqual(len(results.verse_list), 36, |
4482 | - 'The book of John should not have had any verses added or removed') |
4483 | + assert len(results.verse_list) == 36, 'The book of John should not have had any verses added or removed' |
4484 | |
4485 | def test_crosswalk_extract_books(self): |
4486 | """ |
4487 | @@ -108,7 +106,7 @@ |
4488 | books = handler.get_books_from_http('niv') |
4489 | |
4490 | # THEN: We should get back a valid service item |
4491 | - self.assertEqual(len(books), 66, 'The bible should not have had any books added or removed') |
4492 | + assert len(books) == 66, 'The bible should not have had any books added or removed' |
4493 | |
4494 | def test_crosswalk_extract_verse(self): |
4495 | """ |
4496 | @@ -121,8 +119,7 @@ |
4497 | results = handler.get_bible_chapter('niv', 'john', 3) |
4498 | |
4499 | # THEN: We should get back a valid service item |
4500 | - self.assertEqual(len(results.verse_list), 36, |
4501 | - 'The book of John should not have had any verses added or removed') |
4502 | + assert len(results.verse_list) == 36, 'The book of John should not have had any verses added or removed' |
4503 | |
4504 | def test_bibleserver_get_bibles(self): |
4505 | """ |
4506 | @@ -135,9 +132,9 @@ |
4507 | bibles = handler.get_bibles_from_http() |
4508 | |
4509 | # THEN: The list should not be None, and some known bibles should be there |
4510 | - self.assertIsNotNone(bibles) |
4511 | - self.assertIn(('New Int. Readers Version', 'NIRV', 'en'), bibles) |
4512 | - self.assertIn(('Священное Писание, Восточный перевод', 'CARS', 'ru'), bibles) |
4513 | + assert bibles is not None |
4514 | + assert ('New Int. Readers Version', 'NIRV', 'en') in bibles |
4515 | + assert ('Священное Писание, Восточный перевод', 'CARS', 'ru') in bibles |
4516 | |
4517 | def test_biblegateway_get_bibles(self): |
4518 | """ |
4519 | @@ -150,8 +147,8 @@ |
4520 | bibles = handler.get_bibles_from_http() |
4521 | |
4522 | # THEN: The list should not be None, and some known bibles should be there |
4523 | - self.assertIsNotNone(bibles) |
4524 | - self.assertIn(('Holman Christian Standard Bible (HCSB)', 'HCSB', 'en'), bibles) |
4525 | + assert bibles is not None |
4526 | + assert ('Holman Christian Standard Bible (HCSB)', 'HCSB', 'en') in bibles |
4527 | |
4528 | def test_crosswalk_get_bibles(self): |
4529 | """ |
4530 | @@ -164,8 +161,8 @@ |
4531 | bibles = handler.get_bibles_from_http() |
4532 | |
4533 | # THEN: The list should not be None, and some known bibles should be there |
4534 | - self.assertIsNotNone(bibles) |
4535 | - self.assertIn(('Giovanni Diodati 1649 (Italian)', 'gdb', 'it'), bibles) |
4536 | + assert bibles is not None |
4537 | + assert ('Giovanni Diodati 1649 (Italian)', 'gdb', 'it') in bibles |
4538 | |
4539 | def test_crosswalk_get_verse_text(self): |
4540 | """ |
4541 | @@ -178,7 +175,6 @@ |
4542 | niv_genesis_chapter_one = handler.get_bible_chapter('niv', 'Genesis', 1) |
4543 | |
4544 | # THEN: The verse list should contain the verses |
4545 | - self.assertTrue(niv_genesis_chapter_one.has_verse_list()) |
4546 | - self.assertEquals('In the beginning God created the heavens and the earth.', |
4547 | - niv_genesis_chapter_one.verse_list[1], |
4548 | - 'The first chapter of genesis should have been fetched.') |
4549 | + assert niv_genesis_chapter_one.has_verse_list() is True |
4550 | + assert 'In the beginning God created the heavens and the earth.' == niv_genesis_chapter_one.verse_list[1], \ |
4551 | + 'The first chapter of genesis should have been fetched.' |
4552 | |
4553 | === modified file 'tests/interfaces/openlp_plugins/bibles/test_lib_manager.py' |
4554 | --- tests/interfaces/openlp_plugins/bibles/test_lib_manager.py 2017-10-07 07:05:07 +0000 |
4555 | +++ tests/interfaces/openlp_plugins/bibles/test_lib_manager.py 2017-12-24 07:19:49 +0000 |
4556 | @@ -79,7 +79,7 @@ |
4557 | # WHEN asking for the books of the bible |
4558 | books = self.manager.get_books('tests') |
4559 | # THEN a list of books should be returned |
4560 | - self.assertEqual(66, len(books), 'There should be 66 books in the bible') |
4561 | + assert 66 == len(books), 'There should be 66 books in the bible' |
4562 | |
4563 | def test_get_book_by_id(self): |
4564 | """ |
4565 | @@ -89,7 +89,7 @@ |
4566 | # WHEN asking for the book of the bible |
4567 | book = self.manager.get_book_by_id('tests', 54) |
4568 | # THEN a book should be returned |
4569 | - self.assertEqual('1 Timothy', book.name, '1 Timothy should have been returned from the bible') |
4570 | + assert '1 Timothy' == book.name, '1 Timothy should have been returned from the bible' |
4571 | |
4572 | def test_get_chapter_count(self): |
4573 | """ |
4574 | @@ -100,7 +100,7 @@ |
4575 | book = self.manager.get_book_by_id('tests', 54) |
4576 | chapter = self.manager.get_chapter_count('tests', book) |
4577 | # THEN the chapter count should be returned |
4578 | - self.assertEqual(6, chapter, '1 Timothy should have 6 chapters returned from the bible') |
4579 | + assert 6 == chapter, '1 Timothy should have 6 chapters returned from the bible' |
4580 | |
4581 | def test_get_verse_count_by_book_ref_id(self): |
4582 | """ |
4583 | @@ -110,4 +110,4 @@ |
4584 | # WHEN asking for the number of verses in a book of the bible |
4585 | verses = self.manager.get_verse_count_by_book_ref_id('tests', 54, 3) |
4586 | # THEN the chapter count should be returned |
4587 | - self.assertEqual(16, verses, '1 Timothy v3 should have 16 verses returned from the bible') |
4588 | + assert 16 == verses, '1 Timothy v3 should have 16 verses returned from the bible' |
4589 | |
4590 | === modified file 'tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py' |
4591 | --- tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py 2017-10-07 07:05:07 +0000 |
4592 | +++ tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py 2017-12-24 07:19:49 +0000 |
4593 | @@ -79,7 +79,7 @@ |
4594 | # WHEN asking to parse the bible reference |
4595 | results = parse_reference('1 Timothy 1', self.manager.db_cache['tests'], MagicMock(), 54) |
4596 | # THEN a verse array should be returned |
4597 | - self.assertEqual([(54, 1, 1, -1)], results, "The bible verses should matches the expected results") |
4598 | + assert [(54, 1, 1, -1)] == results, "The bible verses should matches the expected results" |
4599 | |
4600 | def test_parse_reference_two(self): |
4601 | """ |
4602 | @@ -89,7 +89,7 @@ |
4603 | # WHEN asking to parse the bible reference |
4604 | results = parse_reference('1 Timothy 1:1-2', self.manager.db_cache['tests'], MagicMock(), 54) |
4605 | # THEN a verse array should be returned |
4606 | - self.assertEqual([(54, 1, 1, 2)], results, "The bible verses should matches the expected results") |
4607 | + assert [(54, 1, 1, 2)] == results, "The bible verses should matches the expected results" |
4608 | |
4609 | def test_parse_reference_three(self): |
4610 | """ |
4611 | @@ -99,8 +99,8 @@ |
4612 | # WHEN asking to parse the bible reference |
4613 | results = parse_reference('1 Timothy 1:1-2:1', self.manager.db_cache['tests'], MagicMock(), 54) |
4614 | # THEN a verse array should be returned |
4615 | - self.assertEqual([(54, 1, 1, -1), (54, 2, 1, 1)], results, |
4616 | - "The bible verses should match the expected results") |
4617 | + assert [(54, 1, 1, -1), (54, 2, 1, 1)] == results, \ |
4618 | + "The bible verses should match the expected results" |
4619 | |
4620 | def test_parse_reference_four(self): |
4621 | """ |
4622 | @@ -110,7 +110,7 @@ |
4623 | # WHEN asking to parse the bible reference |
4624 | results = parse_reference('Raoul 1', self.manager.db_cache['tests'], MagicMock()) |
4625 | # THEN a verse array should be returned |
4626 | - self.assertEqual([], results, "The bible Search should return an empty list") |
4627 | + assert [] == results, "The bible Search should return an empty list" |
4628 | |
4629 | def test_parse_reference_five(self): |
4630 | """ |
4631 | @@ -120,4 +120,4 @@ |
4632 | # WHEN asking to parse the bible reference |
4633 | results = parse_reference('1 Timothy 1:3-end', self.manager.db_cache['tests'], MagicMock(), 54) |
4634 | # THEN a verse array should be returned |
4635 | - self.assertEqual([(54, 1, 3, -1)], results, "The bible verses should matches the expected results") |
4636 | + assert [(54, 1, 3, -1)] == results, "The bible verses should matches the expected results" |
4637 | |
4638 | === modified file 'tests/interfaces/openlp_plugins/custom/forms/test_customform.py' |
4639 | --- tests/interfaces/openlp_plugins/custom/forms/test_customform.py 2017-10-07 07:05:07 +0000 |
4640 | +++ tests/interfaces/openlp_plugins/custom/forms/test_customform.py 2017-12-24 07:19:49 +0000 |
4641 | @@ -78,8 +78,8 @@ |
4642 | self.form.load_custom(0) |
4643 | |
4644 | # THEN: The line edits should not contain any text. |
4645 | - self.assertEqual(self.form.title_edit.text(), '', 'The title edit should be empty') |
4646 | - self.assertEqual(self.form.credit_edit.text(), '', 'The credit edit should be empty') |
4647 | + assert self.form.title_edit.text() == '', 'The title edit should be empty' |
4648 | + assert self.form.credit_edit.text() == '', 'The credit edit should be empty' |
4649 | |
4650 | def test_on_add_button_clicked(self): |
4651 | """ |
4652 | |
4653 | === modified file 'tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py' |
4654 | --- tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py 2017-10-07 07:05:07 +0000 |
4655 | +++ tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py 2017-12-24 07:19:49 +0000 |
4656 | @@ -58,9 +58,9 @@ |
4657 | """ |
4658 | Test the AuthorForm defaults are correct |
4659 | """ |
4660 | - self.assertEqual(self.form.first_name_edit.text(), '', 'The first name edit should be empty') |
4661 | - self.assertEqual(self.form.last_name_edit.text(), '', 'The last name edit should be empty') |
4662 | - self.assertEqual(self.form.display_edit.text(), '', 'The display name edit should be empty') |
4663 | + assert self.form.first_name_edit.text() == '', 'The first name edit should be empty' |
4664 | + assert self.form.last_name_edit.text() == '', 'The last name edit should be empty' |
4665 | + assert self.form.display_edit.text() == '', 'The display name edit should be empty' |
4666 | |
4667 | def test_get_first_name_property(self): |
4668 | """ |
4669 | @@ -73,7 +73,7 @@ |
4670 | self.form.first_name_edit.setText(first_name) |
4671 | |
4672 | # THEN: The first_name property should have the correct value |
4673 | - self.assertEqual(self.form.first_name, first_name, 'The first name property should be correct') |
4674 | + assert self.form.first_name == first_name, 'The first name property should be correct' |
4675 | |
4676 | def test_set_first_name_property(self): |
4677 | """ |
4678 | @@ -86,7 +86,7 @@ |
4679 | self.form.first_name = first_name |
4680 | |
4681 | # THEN: The first_name_edit should have the correct value |
4682 | - self.assertEqual(self.form.first_name_edit.text(), first_name, 'The first name should be set correctly') |
4683 | + assert self.form.first_name_edit.text() == first_name, 'The first name should be set correctly' |
4684 | |
4685 | def test_get_last_name_property(self): |
4686 | """ |
4687 | @@ -99,7 +99,7 @@ |
4688 | self.form.last_name_edit.setText(last_name) |
4689 | |
4690 | # THEN: The last_name property should have the correct value |
4691 | - self.assertEqual(self.form.last_name, last_name, 'The last name property should be correct') |
4692 | + assert self.form.last_name == last_name, 'The last name property should be correct' |
4693 | |
4694 | def test_set_last_name_property(self): |
4695 | """ |
4696 | @@ -112,7 +112,7 @@ |
4697 | self.form.last_name = last_name |
4698 | |
4699 | # THEN: The last_name_edit should have the correct value |
4700 | - self.assertEqual(self.form.last_name_edit.text(), last_name, 'The last name should be set correctly') |
4701 | + assert self.form.last_name_edit.text() == last_name, 'The last name should be set correctly' |
4702 | |
4703 | def test_get_display_name_property(self): |
4704 | """ |
4705 | @@ -125,7 +125,7 @@ |
4706 | self.form.display_edit.setText(display_name) |
4707 | |
4708 | # THEN: The display_name property should have the correct value |
4709 | - self.assertEqual(self.form.display_name, display_name, 'The display name property should be correct') |
4710 | + assert self.form.display_name == display_name, 'The display name property should be correct' |
4711 | |
4712 | def test_set_display_name_property(self): |
4713 | """ |
4714 | @@ -138,7 +138,7 @@ |
4715 | self.form.display_name = display_name |
4716 | |
4717 | # THEN: The display_name_edit should have the correct value |
4718 | - self.assertEqual(self.form.display_edit.text(), display_name, 'The display name should be set correctly') |
4719 | + assert self.form.display_edit.text() == display_name, 'The display name should be set correctly' |
4720 | |
4721 | @patch('openlp.plugins.songs.forms.authorsform.QtWidgets.QDialog.exec') |
4722 | def test_exec(self, mocked_exec): |
4723 | |
4724 | === modified file 'tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py' |
4725 | --- tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py 2017-10-07 07:05:07 +0000 |
4726 | +++ tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py 2017-12-24 07:19:49 +0000 |
4727 | @@ -69,10 +69,10 @@ |
4728 | """ |
4729 | Test that the EditSongForm defaults are correct |
4730 | """ |
4731 | - self.assertFalse(self.form.verse_edit_button.isEnabled(), 'The verse edit button should not be enabled') |
4732 | - self.assertFalse(self.form.verse_delete_button.isEnabled(), 'The verse delete button should not be enabled') |
4733 | - self.assertFalse(self.form.author_remove_button.isEnabled(), 'The author remove button should not be enabled') |
4734 | - self.assertFalse(self.form.topic_remove_button.isEnabled(), 'The topic remove button should not be enabled') |
4735 | + assert self.form.verse_edit_button.isEnabled() is False, 'The verse edit button should not be enabled' |
4736 | + assert self.form.verse_delete_button.isEnabled() is False, 'The verse delete button should not be enabled' |
4737 | + assert self.form.author_remove_button.isEnabled() is False, 'The author remove button should not be enabled' |
4738 | + assert self.form.topic_remove_button.isEnabled() is False, 'The topic remove button should not be enabled' |
4739 | |
4740 | def test_is_verse_edit_form_executed(self): |
4741 | pass |
4742 | @@ -147,10 +147,10 @@ |
4743 | # GIVEN; Mocked methods |
4744 | form = self.form |
4745 | # THEN: CCLI label should be CCLI song label |
4746 | - self.assertNotEquals(form.ccli_label.text(), UiStrings().CCLINumberLabel, |
4747 | - 'CCLI label should not be "{}"'.format(UiStrings().CCLINumberLabel)) |
4748 | - self.assertEquals(form.ccli_label.text(), UiStrings().CCLISongNumberLabel, |
4749 | - 'CCLI label text should be "{}"'.format(UiStrings().CCLISongNumberLabel)) |
4750 | + assert form.ccli_label.text() is not UiStrings().CCLINumberLabel, \ |
4751 | + 'CCLI label should not be "{}"'.format(UiStrings().CCLINumberLabel) |
4752 | + assert form.ccli_label.text() == UiStrings().CCLISongNumberLabel, \ |
4753 | + 'CCLI label text should be "{}"'.format(UiStrings().CCLISongNumberLabel) |
4754 | |
4755 | def test_verse_order_lowercase(self): |
4756 | """ |
4757 | @@ -165,4 +165,4 @@ |
4758 | form.on_verse_order_text_changed(form.verse_order_edit.text()) |
4759 | |
4760 | # THEN: The verse order should be converted to uppercase |
4761 | - self.assertEqual(form.verse_order_edit.text(), 'V1 V2 C1 V3 C1 V4 C1') |
4762 | + assert form.verse_order_edit.text() == 'V1 V2 C1 V3 C1 V4 C1' |
4763 | |
4764 | === modified file 'tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py' |
4765 | --- tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py 2017-10-07 07:05:07 +0000 |
4766 | +++ tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py 2017-12-24 07:19:49 +0000 |
4767 | @@ -68,7 +68,7 @@ |
4768 | # GIVEN: An EditVerseForm instance |
4769 | # WHEN: The form is shown |
4770 | # THEN: The default value is correct |
4771 | - self.assertEqual(self.form.verse_text_edit.toPlainText(), '', 'The verse edit box is empty.') |
4772 | + assert self.form.verse_text_edit.toPlainText() == '', 'The verse edit box is empty.' |
4773 | |
4774 | def test_type_verse_text(self): |
4775 | """ |
4776 | @@ -81,8 +81,8 @@ |
4777 | QtTest.QTest.keyClicks(self.form.verse_text_edit, text) |
4778 | |
4779 | # THEN: The verse text edit should have the verse text in it |
4780 | - self.assertEqual(text, self.form.verse_text_edit.toPlainText(), |
4781 | - 'The verse text edit should have the typed out verse') |
4782 | + assert text == self.form.verse_text_edit.toPlainText(), \ |
4783 | + 'The verse text edit should have the typed out verse' |
4784 | |
4785 | def test_insert_verse(self): |
4786 | """ |
4787 | @@ -93,8 +93,8 @@ |
4788 | QtTest.QTest.mouseClick(self.form.insert_button, QtCore.Qt.LeftButton) |
4789 | |
4790 | # THEN: The verse text edit should have a Verse:1 in it |
4791 | - self.assertIn('---[Verse:1]---', self.form.verse_text_edit.toPlainText(), |
4792 | - 'The verse text edit should have a verse marker') |
4793 | + assert '---[Verse:1]---' in self.form.verse_text_edit.toPlainText(), \ |
4794 | + 'The verse text edit should have a verse marker' |
4795 | |
4796 | def test_insert_verse_2(self): |
4797 | """ |
4798 | @@ -106,8 +106,8 @@ |
4799 | QtTest.QTest.mouseClick(self.form.insert_button, QtCore.Qt.LeftButton) |
4800 | |
4801 | # THEN: The verse text edit should have a Verse:1 in it |
4802 | - self.assertIn('---[Verse:2]---', self.form.verse_text_edit.toPlainText(), |
4803 | - 'The verse text edit should have a "Verse 2" marker') |
4804 | + assert '---[Verse:2]---' in self.form.verse_text_edit.toPlainText(), \ |
4805 | + 'The verse text edit should have a "Verse 2" marker' |
4806 | |
4807 | def test_insert_chorus(self): |
4808 | """ |
4809 | @@ -119,5 +119,5 @@ |
4810 | QtTest.QTest.mouseClick(self.form.insert_button, QtCore.Qt.LeftButton) |
4811 | |
4812 | # THEN: The verse text edit should have a Chorus:1 in it |
4813 | - self.assertIn('---[Chorus:1]---', self.form.verse_text_edit.toPlainText(), |
4814 | - 'The verse text edit should have a "Chorus 1" marker') |
4815 | + assert '---[Chorus:1]---' in self.form.verse_text_edit.toPlainText(), \ |
4816 | + 'The verse text edit should have a "Chorus 1" marker' |
4817 | |
4818 | === modified file 'tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py' |
4819 | --- tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py 2017-10-07 07:05:07 +0000 |
4820 | +++ tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py 2017-12-24 07:19:49 +0000 |
4821 | @@ -57,7 +57,7 @@ |
4822 | """ |
4823 | Test the TopicsForm defaults are correct |
4824 | """ |
4825 | - self.assertEqual(self.form.name_edit.text(), '', 'The first name edit should be empty') |
4826 | + assert self.form.name_edit.text() == '', 'The first name edit should be empty' |
4827 | |
4828 | def test_get_name_property(self): |
4829 | """ |
4830 | @@ -70,7 +70,7 @@ |
4831 | self.form.name_edit.setText(topic_name) |
4832 | |
4833 | # THEN: The name property should have the correct value |
4834 | - self.assertEqual(self.form.name, topic_name, 'The name property should be correct') |
4835 | + assert self.form.name == topic_name, 'The name property should be correct' |
4836 | |
4837 | def test_set_name_property(self): |
4838 | """ |
4839 | @@ -83,4 +83,4 @@ |
4840 | self.form.name = topic_name |
4841 | |
4842 | # THEN: The name_edit should have the correct value |
4843 | - self.assertEqual(self.form.name_edit.text(), topic_name, 'The topic name should be set correctly') |
4844 | + assert self.form.name_edit.text() == topic_name, 'The topic name should be set correctly' |
4845 | |
4846 | === modified file 'tests/utils/test_bzr_tags.py' |
4847 | --- tests/utils/test_bzr_tags.py 2016-12-31 11:01:36 +0000 |
4848 | +++ tests/utils/test_bzr_tags.py 2017-12-24 07:19:49 +0000 |
4849 | @@ -52,4 +52,4 @@ |
4850 | count1 += 1 |
4851 | |
4852 | # THEN the tags should match the accepted tags |
4853 | - self.assertEqual(count, count1, 'List of tags should match') |
4854 | + assert count == count1, 'List of tags should match' |
4855 | |
4856 | === modified file 'tests/utils/test_pylint.py' |
4857 | --- tests/utils/test_pylint.py 2017-11-10 04:11:03 +0000 |
4858 | +++ tests/utils/test_pylint.py 2017-12-24 07:19:49 +0000 |
4859 | @@ -80,7 +80,7 @@ |
4860 | print(stderr) |
4861 | |
4862 | # THEN: The output should be empty |
4863 | - self.assertTrue(filtered_stdout == '', 'PyLint should find no errors') |
4864 | + assert filtered_stdout == '', 'PyLint should find no errors' |
4865 | |
4866 | def _filter_tolerated_errors(self, pylint_output): |
4867 | """ |
Just a few to fix up