Merge lp:~nik90/ubuntu-weather-app/fix-pep8-errors into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 254
Merged at revision: 254
Proposed branch: lp:~nik90/ubuntu-weather-app/fix-pep8-errors
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 976 lines (+308/-156)
5 files modified
tests/autopilot/ubuntu_weather_app/emulators.py (+2/-0)
tests/autopilot/ubuntu_weather_app/tests/__init__.py (+15/-10)
tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py (+69/-33)
tests/autopilot/ubuntu_weather_app/tests/test_mainview.py (+55/-24)
tests/autopilot/ubuntu_weather_app/tests/test_settings.py (+167/-89)
To merge this branch: bzr merge lp:~nik90/ubuntu-weather-app/fix-pep8-errors
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Nicholas Skaggs Pending
Review via email: mp+220098@code.launchpad.net

Commit message

Fixes pep8 errors

Description of the change

Fixes pep8 errors

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

You weren't kidding about the diff on this one!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntu_weather_app/emulators.py'
2--- tests/autopilot/ubuntu_weather_app/emulators.py 2014-03-07 00:45:37 +0000
3+++ tests/autopilot/ubuntu_weather_app/emulators.py 2014-05-19 16:17:21 +0000
4@@ -11,6 +11,7 @@
5
6 from ubuntuuitoolkit import emulators as toolkit_emulators
7
8+
9 class MainView(toolkit_emulators.MainView):
10
11 def get_tabs(self):
12@@ -31,6 +32,7 @@
13 """Return an activity indicator"""
14 return self.select_single("ActivityIndicator", running="True")
15
16+
17 class Tabs(toolkit_emulators.UbuntuUIToolkitEmulatorBase):
18 """LocationTabs Autopilot emulator."""
19
20
21=== modified file 'tests/autopilot/ubuntu_weather_app/tests/__init__.py'
22--- tests/autopilot/ubuntu_weather_app/tests/__init__.py 2014-03-05 00:11:49 +0000
23+++ tests/autopilot/ubuntu_weather_app/tests/__init__.py 2014-05-19 16:17:21 +0000
24@@ -81,13 +81,15 @@
25
26 """Test if tabs with data are present in tablet mode"""
27 def _ensure_tablet_tabs_loaded(self):
28- self.assertThat(lambda: self.main_view.wait_select_single('QQuickRectangle', visible=True, objectName='SideLabel'),
29+ self.assertThat(lambda: self.main_view.wait_select_single(
30+ 'QQuickRectangle', visible=True, objectName='SideLabel'),
31 Eventually(Not(Is(None)), timeout=60))
32
33 @property
34 def main_view(self):
35 return self.app.wait_select_single(emulators.MainView)
36
37+
38 class SheetMixin(object):
39 """A mixin to to give access to common sheet elements"""
40
41@@ -109,14 +111,17 @@
42 def _open_add_location_page(self):
43 """Opens the AddLocationPage"""
44 # click on listitem to open AddLocationPage
45- addCityItem = self.main_view.wait_select_single('Standard', objectName='AddCityListItem')
46+ addCityItem = self.main_view.wait_select_single(
47+ 'Standard', objectName='AddCityListItem')
48 self.assertThat(lambda: addCityItem.visible, Eventually(Equals(True)))
49 self.pointing_device.move_to_object(addCityItem)
50 self.pointing_device.click()
51
52- addLocPage = self.main_view.select_single("DefaultSheet", objectName="AddLocationSheet")
53+ addLocPage = self.main_view.select_single(
54+ "DefaultSheet", objectName="AddLocationSheet")
55 self.assertThat(addLocPage.visible, Eventually(Equals(True)))
56
57+
58 class DatabaseMixin(object):
59
60 """
61@@ -124,7 +129,7 @@
62 """
63
64 app_dir = os.path.expanduser(
65- "~/.local/share/com.ubuntu.weather")
66+ "~/.local/share/com.ubuntu.weather")
67 db_dir = os.path.join(app_dir, 'Databases')
68 db_file = "34e1e542f2f083ff18f537b07a380071.sqlite"
69 db_path = os.path.join(db_dir, db_file)
70@@ -166,10 +171,10 @@
71 #this needs to stay in sync with Storage.qml enties
72 logger.debug("Creating locations and settings tables")
73 self._execute_sql("CREATE TABLE IF NOT EXISTS Locations(id INTEGER "
74- "PRIMARY KEY AUTOINCREMENT, data TEXT, date TEXT)")
75+ "PRIMARY KEY AUTOINCREMENT, data TEXT, date TEXT)")
76
77 self._execute_sql("CREATE TABLE IF NOT EXISTS settings(key TEXT "
78- "UNIQUE, value TEXT)")
79+ "UNIQUE, value TEXT)")
80
81 def get_locations_data(self):
82 result = []
83@@ -196,7 +201,7 @@
84 def add_units_to_database(self):
85 logger.debug("Adding units to database")
86 self._execute_sql("INSERT INTO settings(key, value) "
87- "VALUES('units', 'metric'), "
88- "('wind_units', 'kmh'), "
89- "('precip_units', 'mm'),"
90- "('service', 'weatherchannel')")
91+ "VALUES('units', 'metric'), "
92+ "('wind_units', 'kmh'), "
93+ "('precip_units', 'mm'),"
94+ "('service', 'weatherchannel')")
95
96=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py'
97--- tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2014-03-07 00:35:50 +0000
98+++ tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2014-05-19 16:17:21 +0000
99@@ -9,19 +9,26 @@
100
101 from __future__ import absolute_import
102
103-from testtools.matchers import Equals, Not, NotEquals
104+from testtools.matchers import Equals, Not
105 from autopilot.matchers import Eventually
106 from autopilot.introspection.dbus import StateNotFoundError
107 from unittest import skip
108
109-from ubuntu_weather_app.tests import WeatherTestCase, DatabaseMixin, SheetMixin, LocationManagerMixin
110+from ubuntu_weather_app.tests import (
111+ WeatherTestCase,
112+ DatabaseMixin,
113+ SheetMixin,
114+ LocationManagerMixin
115+)
116
117 from time import sleep
118 import logging
119
120 logger = logging.getLogger(__name__)
121
122-class TestLocationManager(WeatherTestCase, DatabaseMixin, SheetMixin, LocationManagerMixin):
123+
124+class TestLocationManager(WeatherTestCase, DatabaseMixin, SheetMixin,
125+ LocationManagerMixin):
126
127 def setUp(self):
128 #we want to start with no database
129@@ -46,34 +53,41 @@
130
131 def _open_location_manager(self, kb=False):
132 """Opens the location manager"""
133- if kb: self.keyboard.press_and_release('Ctrl+n')
134- else: self.main_view.open_toolbar().click_button("EditButton")
135+ if kb:
136+ self.keyboard.press_and_release('Ctrl+n')
137+ else:
138+ self.main_view.open_toolbar().click_button("EditButton")
139
140 # test location manager becomes visible
141- managerSheet = self.main_view.select_single('ComposerSheet', objectName='LocationManagerSheet')
142+ managerSheet = self.main_view.select_single(
143+ 'ComposerSheet', objectName='LocationManagerSheet')
144 self.assertThat(managerSheet.visible, Eventually(Equals(True)))
145
146 def _swipe_first_location_to_remove(self):
147 """Swipe right to delete the first location"""
148- first_location = self.app.wait_select_single("Standard", objectName="existingLocationItem0")
149+ first_location = self.app.wait_select_single(
150+ "Standard", objectName="existingLocationItem0")
151 number_of_locations = self._get_number_of_locations()
152
153 x, y, w, h = first_location.globalRect
154 tx = x + (w / 8)
155 ty = y + (h / 2)
156- self.pointing_device.drag(tx, ty, tx + w/4*3 , ty)
157- self.assertThat(self._get_number_of_locations, Eventually(Equals(number_of_locations-1)))
158+ self.pointing_device.drag(tx, ty, tx + w/4*3, ty)
159+ self.assertThat(self._get_number_of_locations,
160+ Eventually(Equals(number_of_locations-1)))
161
162 def _get_number_of_locations(self):
163- qqlw = self.app.wait_select_single("ComposerSheet").wait_select_single("QQuickListView")
164+ qqlw = self.app.wait_select_single("ComposerSheet").wait_select_single(
165+ "QQuickListView")
166 return qqlw.count
167
168 def _search_for_city(self, city):
169- searchField = self.main_view.wait_select_single("TextField", objectName="SearchField")
170- #poll clicking for focus for lack of better method, due to screen switching animation
171- #is there a property we can use instead?
172+ searchField = self.main_view.wait_select_single(
173+ "TextField", objectName="SearchField")
174+ #poll clicking for focus for lack of better method, due to screen
175+ # switching animation is there a property we can use instead?
176 timeout = 0
177- while searchField.focus != True and timeout < 10:
178+ while searchField.focus is not True and timeout < 10:
179 self.pointing_device.click_object(searchField)
180 sleep(1)
181 timeout += 1
182@@ -90,9 +104,11 @@
183
184 # wait for results and click on the first item
185 self.main_view.wait_for_activity_to_finish()
186- resultsList = self.main_view.select_single('QQuickListView', objectName='SearchResultList')
187+ resultsList = self.main_view.select_single(
188+ 'QQuickListView', objectName='SearchResultList')
189 self.assertThat(resultsList.visible, Eventually(Equals(True)))
190- firstResult = self.main_view.wait_select_single('Label', objectName='searchResult0')
191+ firstResult = self.main_view.wait_select_single(
192+ 'Label', objectName='searchResult0')
193 self.pointing_device.move_to_object(firstResult)
194 self.pointing_device.click()
195
196@@ -110,7 +126,8 @@
197 self._click_sheet_confirm()
198
199 def _verify_location(self, title, index):
200- location = self.main_view.wait_select_single('LocationTab', objectName='LocationTab{}'.format(index))
201+ location = self.main_view.wait_select_single(
202+ 'LocationTab', objectName='LocationTab{}'.format(index))
203 self.assertThat(location.title, Equals(title))
204 self.assertThat(location.index, Equals(index))
205 self.assertThat(location.visible, Equals(True))
206@@ -132,15 +149,18 @@
207 """Adds a location"""
208 self._open_add_location_page()
209
210- resultsList = self.main_view.select_single('QQuickListView', objectName='SearchResultList')
211+ resultsList = self.main_view.select_single(
212+ 'QQuickListView', objectName='SearchResultList')
213 self.assertThat(resultsList.visible, Eventually(Equals(True)))
214- testResult = self.main_view.wait_select_single('Label', objectName='searchResult4')
215+ testResult = self.main_view.wait_select_single(
216+ 'Label', objectName='searchResult4')
217 self.pointing_device.move_to_object(testResult)
218 self.pointing_device.click()
219
220 # LocationManagerPage should be visible and location added
221 location = "Cairo"
222- addedItem = self.main_view.wait_select_single('Label', objectName="existingLocation0")
223+ addedItem = self.main_view.wait_select_single(
224+ 'Label', objectName="existingLocation0")
225 self.assertThat(addedItem.text, Eventually(Equals(location)))
226 self._click_sheet_confirm()
227
228@@ -159,13 +179,16 @@
229
230 # wait for results and click on the first item
231 self.main_view.wait_for_activity_to_finish()
232- resultsList = self.main_view.select_single('QQuickListView', objectName='SearchResultList')
233+ resultsList = self.main_view.select_single(
234+ 'QQuickListView', objectName='SearchResultList')
235 self.assertThat(resultsList.visible, Eventually(Equals(True)))
236- firstResult = self.main_view.wait_select_single("Label", objectName="searchResult0")
237+ firstResult = self.main_view.wait_select_single(
238+ "Label", objectName="searchResult0")
239 self.assertThat(firstResult.text, Eventually(Equals("London")))
240
241 # regain focus, clear search field and do another search
242- searchField = self.main_view.wait_select_single("TextField", objectName="SearchField")
243+ searchField = self.main_view.wait_select_single(
244+ "TextField", objectName="SearchField")
245 self.pointing_device.click_object(searchField)
246 clear_button = searchField.wait_select_single("AbstractButton")
247 self.pointing_device.click_object(clear_button)
248@@ -176,14 +199,16 @@
249 self.keyboard.press_and_release('Enter')
250 self.main_view.wait_for_activity_to_finish()
251 self.assertThat(resultsList.visible, Eventually(Equals(True)))
252- firstResult = self.main_view.wait_select_single("Label", objectName="searchResult0")
253+ firstResult = self.main_view.wait_select_single(
254+ "Label", objectName="searchResult0")
255 self.assertThat(firstResult.text, Eventually(Equals("Hamburg")))
256
257 def test_cancel_adding_location(self):
258 """Cancel the cities search"""
259 self._open_add_location_page()
260 self._click_sheet_cancel()
261- locationList = self.main_view.wait_select_single('QQuickListView', objectName='LocationList')
262+ locationList = self.main_view.wait_select_single(
263+ 'QQuickListView', objectName='LocationList')
264 self.assertThat(locationList.visible, Eventually(Equals(True)))
265
266 def test_no_location_found(self):
267@@ -195,29 +220,34 @@
268
269 # wait for result and look if label is shown
270 self.main_view.wait_for_activity_to_finish()
271- errorLabel = self.main_view.select_single('Label', objectName='noCityError')
272+ errorLabel = self.main_view.select_single('Label',
273+ objectName='noCityError')
274 self.assertThat(errorLabel.visible, Eventually(Equals(True)))
275
276 def test_location_lookup(self):
277 """Tests the location lookup"""
278 # start lookup
279- lookupItem = self.main_view.wait_select_single('Standard', objectName='LocationLookupItem')
280+ lookupItem = self.main_view.wait_select_single(
281+ 'Standard', objectName='LocationLookupItem')
282 self.pointing_device.click_object(lookupItem)
283
284 # wait for result
285 self.main_view.wait_for_activity_to_finish()
286
287 # check a location was found
288- location = self.main_view.wait_select_single('Label', objectName='CurrentLocationLabel')
289+ location = self.main_view.wait_select_single(
290+ 'Label', objectName='CurrentLocationLabel')
291 self.assertThat(location.text, Eventually(Not(Equals(""))))
292 location_name = location.text
293
294 # add location
295- add_button = self.main_view.wait_select_single('Button', objectName='LookupItemAddButton')
296+ add_button = self.main_view.wait_select_single(
297+ 'Button', objectName='LookupItemAddButton')
298 self.pointing_device.click_object(add_button)
299
300 # LocationManagerPage should be visible and location added
301- addedItem = self.main_view.wait_select_single('Label', objectName="existingLocation0")
302+ addedItem = self.main_view.wait_select_single(
303+ 'Label', objectName="existingLocation0")
304 self.assertThat(addedItem.text, Eventually(Equals(location_name)))
305 self._click_sheet_confirm()
306
307@@ -299,7 +329,9 @@
308
309 # close sheet by keyboard and test
310 self.keyboard.press_and_release('Escape')
311- self.assertRaises(StateNotFoundError, lambda: self.main_view.select_single('ComposerSheet'))
312+ self.assertRaises(
313+ StateNotFoundError,
314+ lambda: self.main_view.select_single('ComposerSheet'))
315
316 @skip("skipped because of Bug #1279073")
317 def test_add_location_keyboard(self):
318@@ -311,5 +343,9 @@
319
320 # close sheet by keyboard and test all sheets are closed
321 self.keyboard.press_and_release('Escape')
322- self.assertRaises(StateNotFoundError, lambda: self.main_view.select_single('DefaultSheet'))
323- self.assertRaises(StateNotFoundError, lambda: self.main_view.select_single('ComposerSheet'))
324+ self.assertRaises(
325+ StateNotFoundError,
326+ lambda: self.main_view.select_single('DefaultSheet'))
327+ self.assertRaises(
328+ StateNotFoundError,
329+ lambda: self.main_view.select_single('ComposerSheet'))
330
331=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_mainview.py'
332--- tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2014-03-06 23:13:20 +0000
333+++ tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2014-05-19 16:17:21 +0000
334@@ -11,7 +11,7 @@
335
336 from __future__ import absolute_import
337
338-from testtools.matchers import Equals, Is, Not, NotEquals
339+from testtools.matchers import Equals, Is, Not
340 from autopilot.matchers import Eventually
341 from unittest import skip
342
343@@ -21,6 +21,7 @@
344
345 logger = logging.getLogger(__name__)
346
347+
348 class TestMainView(WeatherTestCase, DatabaseMixin):
349 """Tests creating weather"""
350
351@@ -41,7 +42,7 @@
352 second tab"""
353
354 # first tab should be visible after start
355- tabs = self.main_view.get_tabs()
356+ tabs = self.main_view.get_tabs()
357 first_tab = self.main_view.select_single(
358 'LocationTab', index=0)
359 second_tab = self.main_view.select_single(
360@@ -52,9 +53,12 @@
361 self.assertThat(first_tab.title, Eventually(Equals("Hamburg")))
362
363 # switch to next tab
364- if kb and not back: self.keyboard.press_and_release('Ctrl+Tab')
365- elif kb and back: self.keyboard.press_and_release('Ctrl+Shift+Tab')
366- else: self.main_view.switch_to_tab_by_index(1)
367+ if kb and not back:
368+ self.keyboard.press_and_release('Ctrl+Tab')
369+ elif kb and back:
370+ self.keyboard.press_and_release('Ctrl+Shift+Tab')
371+ else:
372+ self.main_view.switch_to_tab_by_index(1)
373
374 self.assertThat(tabs.selectedTabIndex, Eventually(Equals(1)))
375 self.assertThat(first_tab.visible, Eventually(Equals(False)))
376@@ -62,19 +66,28 @@
377 self.assertThat(second_tab.title, Eventually(Equals("London")))
378
379 def test_switch_tabs(self):
380- """Test start of app with two locations and switch from first to second tab"""
381+ """
382+ Test start of app with two locations and switch from first to second
383+ tab
384+ """
385 self._switch_tabs()
386
387 @skip("skipped because of Bug #1279073")
388 def test_switch_tabs_keyboard(self):
389- """Test start of app with two locations and switch from first to second tab"""
390+ """
391+ Test start of app with two locations and switch from first to second
392+ tab
393+ """
394 if self.platform_model != "Desktop":
395 return
396 self._switch_tabs(kb=True)
397
398 @skip("skipped because of Bug #1279073")
399 def test_switch_tabs_keyboard_back(self):
400- """Test start of app with two locations and switch from first to second tab"""
401+ """
402+ Test start of app with two locations and switch from first to second
403+ tab
404+ """
405 if self.platform_model != "Desktop":
406 return
407 self._switch_tabs(kb=True, back=True)
408@@ -83,19 +96,26 @@
409 # get the dates from the test data
410 if self.main_view.wideAspect:
411 self._ensure_tablet_tabs_loaded()
412- self.assertThat(lambda: self.main_view.select_many('Label', objectName='DayDateLabel'), Eventually(Not(Is(None))))
413- curr_dates = self.main_view.select_many('Label', objectName='DayDateLabel')
414+ self.assertThat(lambda: self.main_view.select_many(
415+ 'Label', objectName='DayDateLabel'), Eventually(Not(Is(None))))
416+ curr_dates = self.main_view.select_many('Label',
417+ objectName='DayDateLabel')
418 tab1_curr_date = curr_dates[0].text
419 tab2_curr_date = curr_dates[2].text
420
421 # refresh and wait till loading has finished
422- if kb: self.keyboard.press_and_release('Ctrl+r')
423- else: self.main_view.open_toolbar().click_button("RefreshButton")
424+ if kb:
425+ self.keyboard.press_and_release('Ctrl+r')
426+ else:
427+ self.main_view.open_toolbar().click_button("RefreshButton")
428 self.main_view.wait_for_activity_to_finish()
429
430 # get the data from the refreshed tabs, have to be new
431- self.assertThat(lambda: self.main_view.select_many('Label',objectName='DayDateLabel'), Eventually(Not(Is(None)), timeout=60))
432- refreshed_dates = self.main_view.select_many('Label',objectName='DayDateLabel')
433+ self.assertThat(lambda: self.main_view.select_many(
434+ 'Label', objectName='DayDateLabel'),
435+ Eventually(Not(Is(None)), timeout=60))
436+ refreshed_dates = self.main_view.select_many('Label',
437+ objectName='DayDateLabel')
438 self.assertNotEqual(tab1_curr_date, refreshed_dates[0].text)
439 self.assertNotEqual(tab2_curr_date, refreshed_dates[2].text)
440
441@@ -113,21 +133,26 @@
442 # get the dates from the test data
443 if self.platform_model != "Desktop":
444 return
445- self.assertThat(lambda: self.main_view.select_many('QQuickListView', objectName='DailyForecastList'), Eventually(Not(Is(None))))
446- dayLists = self.main_view.select_many('QQuickListView', objectName='DailyForecastList')
447+ self.assertThat(lambda: self.main_view.select_many(
448+ 'QQuickListView', objectName='DailyForecastList'),
449+ Eventually(Not(Is(None))))
450+ dayLists = self.main_view.select_many('QQuickListView',
451+ objectName='DailyForecastList')
452 self.assertThat(dayLists[1].visible, Eventually(Equals(True)))
453 self.assertThat(dayLists[1].currentIndex, Eventually(Equals(0)))
454
455 # navigate to to overmorrow
456 self.keyboard.press_and_release('Down')
457 self.keyboard.press_and_release('Down')
458- dayLists = self.main_view.select_many('QQuickListView', objectName='DailyForecastList')
459+ dayLists = self.main_view.select_many('QQuickListView',
460+ objectName='DailyForecastList')
461 self.assertThat(dayLists[1].visible, Eventually(Equals(True)))
462 self.assertThat(dayLists[1].currentIndex, Eventually(Equals(2)))
463
464 # navigate to tomorrow
465 self.keyboard.press_and_release('Up')
466- dayLists = self.main_view.select_many('QQuickListView', objectName='DailyForecastList')
467+ dayLists = self.main_view.select_many('QQuickListView',
468+ objectName='DailyForecastList')
469 self.assertThat(dayLists[1].visible, Eventually(Equals(True)))
470 self.assertThat(dayLists[1].currentIndex, Eventually(Equals(1)))
471
472@@ -135,24 +160,30 @@
473 def test_show_details_keyboard(self):
474 if self.platform_model != "Desktop":
475 return
476- self.assertThat(lambda: self.main_view.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True))))
477- back_flipped = self.main_view.select_many('QQuickFlipable', state="back")
478+ self.assertThat(lambda: self.main_view.select_many(
479+ 'QQuickFlickable', state="back"), Eventually(Not(Is(True))))
480+ back_flipped = self.main_view.select_many('QQuickFlipable',
481+ state="back")
482 self.assertEqual(0, len(back_flipped))
483
484 # press space
485 self.keyboard.press_and_release('Space')
486
487 # check the displayed info is flipped and only one is flipped
488- self.assertThat(lambda: self.main_view.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True))))
489+ self.assertThat(lambda: self.main_view.select_many(
490+ 'QQuickFlickable', state="back"), Eventually(Not(Is(True))))
491 flipables = self.main_view.select_many('QQuickFlipable')
492 self.assertThat(flipables[1].state, Eventually(Equals("back")))
493- back_flipped = self.main_view.select_many('QQuickFlipable', state="back")
494+ back_flipped = self.main_view.select_many('QQuickFlipable',
495+ state="back")
496 self.assertEqual(1, len(back_flipped))
497
498 # press space again, hide details
499 self.keyboard.press_and_release('Space')
500
501 # check nothing is flipped
502- self.assertThat(lambda: self.main_view.select_many('QQuickFlickable', state="back"), Eventually(Not(Is(True))))
503- back_flipped = self.main_view.select_many('QQuickFlipable', state="back")
504+ self.assertThat(lambda: self.main_view.select_many(
505+ 'QQuickFlickable', state="back"), Eventually(Not(Is(True))))
506+ back_flipped = self.main_view.select_many('QQuickFlipable',
507+ state="back")
508 self.assertEqual(0, len(back_flipped))
509
510=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_settings.py'
511--- tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2014-05-13 10:02:21 +0000
512+++ tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2014-05-19 16:17:21 +0000
513@@ -10,7 +10,7 @@
514 from __future__ import absolute_import
515
516 from unittest import skip
517-from testtools.matchers import Equals, Is, Not, NotEquals
518+from testtools.matchers import Equals, Is, Not
519 from autopilot.matchers import Eventually
520 import logging
521
522@@ -18,6 +18,7 @@
523
524 logger = logging.getLogger(__name__)
525
526+
527 class TestSettings(WeatherTestCase, DatabaseMixin, SheetMixin):
528 def setUp(self):
529 #we want to start with fake settings data
530@@ -34,17 +35,22 @@
531 self.main_view.open_toolbar().click_button("SettingsButton")
532
533 def _move_pointer_around(self):
534- """Helper method to move the pointer around, to assure selector is opened"""
535- self.assertThat(lambda: self.main_view.select_single('ComposerSheet', objectName='SettingsSheet'),
536+ """
537+ Helper method to move the pointer around, to assure selector is opened
538+ """
539+ self.assertThat(lambda: self.main_view.select_single(
540+ 'ComposerSheet', objectName='SettingsSheet'),
541 Eventually(Not(Is(None))))
542- sheet = self.main_view.select_single('ComposerSheet', objectName='SettingsSheet')
543+ sheet = self.main_view.select_single('ComposerSheet',
544+ objectName='SettingsSheet')
545 self.pointing_device.move_to_object(sheet)
546
547 def _check_units(self, units):
548 """Checks selected units by values from the first location tab"""
549 if self.main_view.wideAspect:
550 self._ensure_tablet_tabs_loaded()
551- self.assertThat(lambda: self.main_view.select_many('QQuickText', objectName='CurrentTempText'),
552+ self.assertThat(lambda: self.main_view.select_many(
553+ 'QQuickText', objectName='CurrentTempText'),
554 Eventually(Not(Is(None))))
555 current_location_tab = self.main_view.wait_select_single(
556 'LocationTab', visible=True)
557@@ -71,20 +77,25 @@
558 """Checks selected units by values from the first location tab"""
559 if self.main_view.wideAspect:
560 self._ensure_tablet_tabs_loaded()
561- self.assertThat(lambda: self.main_view.select_many('WeatherDetailComponent', objectName='WindSpeedValue')[0],
562- Eventually(Not(Is(None))))
563+ self.assertThat(lambda: self.main_view.select_many(
564+ 'WeatherDetailComponent', objectName='WindSpeedValue')[0],
565+ Eventually(Not(Is(None))))
566 current_location_tab = self.main_view.select_single(
567 'LocationTab', visible=True)
568 focused_item = current_location_tab.select_single(
569 'QQuickItem', focus=True)
570 wind_component = focused_item.select_single(
571 'WeatherDetailComponent', objectName='WindSpeedValue')
572- self.assertThat(lambda: wind_component.select_single('Label', objectName='WeatherDetailUnit'),
573- Eventually(Not(Is(None))))
574- wind_unit = wind_component.select_single('Label', objectName='WeatherDetailUnit')
575- self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailValue'),
576- Eventually(Not(Is(None))))
577- wind_value = wind_component.select_single('QQuickText', objectName='WeatherDetailValue')
578+ self.assertThat(lambda: wind_component.select_single(
579+ 'Label', objectName='WeatherDetailUnit'),
580+ Eventually(Not(Is(None))))
581+ wind_unit = wind_component.select_single(
582+ 'Label', objectName='WeatherDetailUnit')
583+ self.assertThat(lambda: wind_component.select_single(
584+ 'QQuickText', objectName='WeatherDetailValue'),
585+ Eventually(Not(Is(None))))
586+ wind_value = wind_component.select_single(
587+ 'QQuickText', objectName='WeatherDetailValue')
588 if wind_units == "mph":
589 self.assertThat(wind_unit.text, Eventually(Equals(u'mph W')))
590 self.assertThat(wind_value.text, Eventually(Equals(u'19')))
591@@ -96,7 +107,8 @@
592 """Checks selected units by values from the first location tab"""
593 if self.main_view.wideAspect:
594 self._ensure_tablet_tabs_loaded()
595- self.assertThat(lambda: self.main_view.select_many('WeatherDetailComponent', objectName='PrecipitationValue')[0],
596+ self.assertThat(lambda: self.main_view.select_many(
597+ 'WeatherDetailComponent', objectName='PrecipitationValue')[0],
598 Eventually(Not(Is(None))))
599 current_location_tab = self.main_view.select_single(
600 'LocationTab', visible=True)
601@@ -104,12 +116,16 @@
602 'QQuickItem', focus=True)
603 component = focused_item.select_single(
604 'WeatherDetailComponent', objectName='PrecipitationValue')
605- self.assertThat(lambda: component.select_many('QQuickText', objectName='WeatherDetailUnit'),
606- Eventually(Not(Is(None))))
607- unit = component.select_single('QQuickText', objectName='WeatherDetailUnit')
608- self.assertThat(lambda: component.select_single('QQuickText', objectName='WeatherDetailValue'),
609- Eventually(Not(Is(None))))
610- value = component.select_single('QQuickText', objectName='WeatherDetailValue')
611+ self.assertThat(lambda: component.select_many(
612+ 'QQuickText', objectName='WeatherDetailUnit'),
613+ Eventually(Not(Is(None))))
614+ unit = component.select_single('QQuickText',
615+ objectName='WeatherDetailUnit')
616+ self.assertThat(lambda: component.select_single(
617+ 'QQuickText', objectName='WeatherDetailValue'),
618+ Eventually(Not(Is(None))))
619+ value = component.select_single('QQuickText',
620+ objectName='WeatherDetailValue')
621 if pre_units == "in":
622 self.assertThat(unit.text, Eventually(Equals(u'in')))
623 self.assertThat(value.text, Eventually(Equals(u'0.18')))
624@@ -118,20 +134,27 @@
625 self.assertThat(value.text, Eventually(Equals(u'0.5')))
626
627 def _check_service(self, service):
628- """Checks selected units weather data service from the first location tab"""
629+ """
630+ Checks selected units weather data service from the first location tab
631+ """
632 if self.main_view.wideAspect:
633 self._ensure_tablet_tabs_loaded()
634- self.assertThat(lambda: self.main_view.select_many('TabFooter', objectName='TabFooter')[0],
635- Eventually(Not(Is(None))))
636- current_location_tab = self.main_view.select_single('LocationTab', visible=True)
637- self.assertThat(lambda: current_location_tab.select_single('TabFooter', objectName='TabFooter'),
638- Eventually(Not(Is(None))))
639- self.assertThat(lambda: current_location_tab.select_single('QQuickImage', objectName='DataProviderLogo'),
640+ self.assertThat(lambda: self.main_view.select_many(
641+ 'TabFooter', objectName='TabFooter')[0],
642+ Eventually(Not(Is(None))))
643+ current_location_tab = self.main_view.select_single('LocationTab',
644+ visible=True)
645+ self.assertThat(lambda: current_location_tab.select_single(
646+ 'TabFooter', objectName='TabFooter'),
647+ Eventually(Not(Is(None))))
648+ self.assertThat(lambda: current_location_tab.select_single(
649+ 'QQuickImage', objectName='DataProviderLogo'),
650 Eventually(Not(Is(None))))
651
652- focused_item = current_location_tab.select_single('QQuickItem', focus=True)
653- tab_footer = current_location_tab.select_single('TabFooter', objectName='TabFooter')
654- provider_logo = current_location_tab.select_single('QQuickImage', objectName='DataProviderLogo')
655+ tab_footer = current_location_tab.select_single('TabFooter',
656+ objectName='TabFooter')
657+ provider_logo = current_location_tab.select_single(
658+ 'QQuickImage', objectName='DataProviderLogo')
659 if service == "weatherchannel":
660 self.assertThat(tab_footer.visible, Eventually(Equals(True)))
661 self.assertThat(provider_logo.visible, Eventually(Equals(False)))
662@@ -146,18 +169,24 @@
663 self._open_settings_sheet()
664
665 # open the value selector
666- self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='TemperatureUnitsSelector'),
667+ self.assertThat(lambda: self.main_view.select_single(
668+ 'OptionSelector', objectName='TemperatureUnitsSelector'),
669 Eventually(Not(Is(None))))
670- units_selector = self.main_view.select_single('OptionSelector', objectName="TemperatureUnitsSelector")
671+ units_selector = self.main_view.select_single(
672+ 'OptionSelector', objectName="TemperatureUnitsSelector")
673 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
674- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
675- current_option = units_selector.select_many('OptionSelectorDelegate')[1]
676+ self.assertThat(lambda: units_selector.select_many(
677+ 'OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
678+ current_option = units_selector.select_many(
679+ 'OptionSelectorDelegate')[1]
680 self.pointing_device.click_object(current_option)
681
682 # choose second option, fahrenheit
683 self._move_pointer_around()
684- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
685- imperial_option = units_selector.select_many('OptionSelectorDelegate')[0]
686+ self.assertThat(lambda: units_selector.select_many(
687+ 'OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
688+ imperial_option = units_selector.select_many(
689+ 'OptionSelectorDelegate')[0]
690 self.pointing_device.click_object(imperial_option)
691 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
692 self._click_sheet_confirm()
693@@ -168,19 +197,24 @@
694
695 # switch back to metric values again
696 self._open_settings_sheet()
697- self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='TemperatureUnitsSelector'),
698+ self.assertThat(lambda: self.main_view.select_single(
699+ 'OptionSelector', objectName='TemperatureUnitsSelector'),
700 Eventually(Not(Is(None))))
701- units_selector = self.main_view.select_single('OptionSelector', objectName="TemperatureUnitsSelector")
702+ units_selector = self.main_view.select_single(
703+ 'OptionSelector', objectName="TemperatureUnitsSelector")
704 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
705- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
706- current_option = units_selector.select_many('OptionSelectorDelegate')[0]
707+ self.assertThat(lambda: units_selector.select_many(
708+ 'OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
709+ current_option = units_selector.select_many(
710+ 'OptionSelectorDelegate')[0]
711 self.pointing_device.click_object(current_option)
712 # while it's opened, units_selector returns false
713 # self.assertThat(units_selector.expanded, Eventually(Equals(True)))
714
715 # click celsius option
716 self._move_pointer_around()
717- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
718+ self.assertThat(lambda: units_selector.select_many(
719+ 'OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
720 metric_option = units_selector.select_single(
721 'OptionSelectorDelegate', objectName='celsiusOption')
722 self.pointing_device.click_object(metric_option)
723@@ -201,31 +235,40 @@
724 self._open_settings_sheet()
725
726 # open the temp value selector
727- self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='TemperatureUnitsSelector'),
728+ self.assertThat(lambda: self.main_view.select_single(
729+ 'OptionSelector', objectName='TemperatureUnitsSelector'),
730 Eventually(Not(Is(None))))
731- units_selector = self.main_view.select_single('OptionSelector', objectName="TemperatureUnitsSelector")
732+ units_selector = self.main_view.select_single(
733+ 'OptionSelector', objectName="TemperatureUnitsSelector")
734 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
735- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
736- current_option = units_selector.select_many('OptionSelectorDelegate')[1]
737+ self.assertThat(lambda: units_selector.select_many(
738+ 'OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
739+ current_option = units_selector.select_many(
740+ 'OptionSelectorDelegate')[1]
741 self.pointing_device.click_object(current_option)
742
743 # choose second option, fahrenheit
744 self._move_pointer_around()
745- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
746- imperial_option = units_selector.select_many('OptionSelectorDelegate')[0]
747+ self.assertThat(lambda: units_selector.select_many(
748+ 'OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
749+ imperial_option = units_selector.select_many(
750+ 'OptionSelectorDelegate')[0]
751 self.pointing_device.click_object(imperial_option)
752 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
753
754 # open the wind value selector
755- self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='WindUnitsSelector'),
756+ self.assertThat(lambda: self.main_view.select_single(
757+ 'OptionSelector', objectName='WindUnitsSelector'),
758 Eventually(Not(Is(None))))
759- units_selector = self.main_view.select_single('OptionSelector', objectName="WindUnitsSelector")
760+ units_selector = self.main_view.select_single(
761+ 'OptionSelector', objectName="WindUnitsSelector")
762 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
763 self.pointing_device.click_object(units_selector)
764
765 # choose second option, mph
766 self._move_pointer_around()
767- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
768+ self.assertThat(lambda: units_selector.select_many(
769+ 'OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
770 mph_option = units_selector.select_many('OptionSelectorDelegate')[1]
771 self.pointing_device.click_object(mph_option)
772 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
773@@ -242,17 +285,22 @@
774 self._open_settings_sheet()
775
776 # open the wind value selector
777- self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='WindUnitsSelector'),
778+ self.assertThat(lambda: self.main_view.select_single(
779+ 'OptionSelector', objectName='WindUnitsSelector'),
780 Eventually(Not(Is(None))))
781- units_selector = self.main_view.select_single('OptionSelector', objectName="WindUnitsSelector")
782+ units_selector = self.main_view.select_single(
783+ 'OptionSelector', objectName="WindUnitsSelector")
784 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
785- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
786- current_option = units_selector.select_many('OptionSelectorDelegate')[1]
787+ self.assertThat(lambda: units_selector.select_many(
788+ 'OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
789+ current_option = units_selector.select_many(
790+ 'OptionSelectorDelegate')[1]
791 self.pointing_device.click_object(current_option)
792
793 # choose second option, mph
794 self._move_pointer_around()
795- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
796+ self.assertThat(lambda: units_selector.select_many(
797+ 'OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
798 mph_option = units_selector.select_many('OptionSelectorDelegate')[0]
799 self.pointing_device.click_object(mph_option)
800 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
801@@ -264,19 +312,24 @@
802
803 # switch back to kmh values again
804 self._open_settings_sheet()
805- self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='WindUnitsSelector'),
806+ self.assertThat(lambda: self.main_view.select_single(
807+ 'OptionSelector', objectName='WindUnitsSelector'),
808 Eventually(Not(Is(None))))
809- units_selector = self.main_view.select_single('OptionSelector', objectName="WindUnitsSelector")
810+ units_selector = self.main_view.select_single(
811+ 'OptionSelector', objectName="WindUnitsSelector")
812 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
813- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
814- current_option = units_selector.select_many('OptionSelectorDelegate')[0]
815+ self.assertThat(lambda: units_selector.select_many(
816+ 'OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
817+ current_option = units_selector.select_many(
818+ 'OptionSelectorDelegate')[0]
819 self.pointing_device.click_object(current_option)
820 # while it's opened, units_selector returns false
821 # self.assertThat(units_selector.expanded, Eventually(Equals(True)))
822
823 # click kmh option
824 self._move_pointer_around()
825- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
826+ self.assertThat(lambda: units_selector.select_many(
827+ 'OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
828 kmh_option = units_selector.select_single(
829 'OptionSelectorDelegate', objectName='kmhOption')
830 self.pointing_device.click_object(kmh_option)
831@@ -297,17 +350,22 @@
832 self._open_settings_sheet()
833
834 # open the precipitation value selector
835- self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'),
836+ self.assertThat(lambda: self.main_view.select_single(
837+ 'OptionSelector', objectName='PrecipitationUnitsSelector'),
838 Eventually(Not(Is(None))))
839- units_selector = self.main_view.select_single('OptionSelector', objectName="PrecipitationUnitsSelector")
840+ units_selector = self.main_view.select_single(
841+ 'OptionSelector', objectName="PrecipitationUnitsSelector")
842 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
843- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
844- current_option = units_selector.select_many('OptionSelectorDelegate')[1]
845+ self.assertThat(lambda: units_selector.select_many(
846+ 'OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
847+ current_option = units_selector.select_many(
848+ 'OptionSelectorDelegate')[1]
849 self.pointing_device.click_object(current_option)
850
851 # choose second option, inch
852 self._move_pointer_around()
853- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
854+ self.assertThat(lambda: units_selector.select_many(
855+ 'OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
856 in_option = units_selector.select_many('OptionSelectorDelegate')[0]
857 self.pointing_device.click_object(in_option)
858 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
859@@ -319,19 +377,24 @@
860
861 # switch back to mm values again
862 self._open_settings_sheet()
863- self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'),
864+ self.assertThat(lambda: self.main_view.select_single(
865+ 'OptionSelector', objectName='PrecipitationUnitsSelector'),
866 Eventually(Not(Is(None))))
867- units_selector = self.main_view.select_single('OptionSelector', objectName="PrecipitationUnitsSelector")
868+ units_selector = self.main_view.select_single(
869+ 'OptionSelector', objectName="PrecipitationUnitsSelector")
870 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
871- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
872- current_option = units_selector.select_many('OptionSelectorDelegate')[0]
873+ self.assertThat(lambda: units_selector.select_many(
874+ 'OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
875+ current_option = units_selector.select_many(
876+ 'OptionSelectorDelegate')[0]
877 self.pointing_device.click_object(current_option)
878 # while it's opened, units_selector returns false
879 # self.assertThat(units_selector.expanded, Eventually(Equals(True)))
880
881 # click mm option
882 self._move_pointer_around()
883- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
884+ self.assertThat(lambda: units_selector.select_many(
885+ 'OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
886 # XXX select the option by it's object name or index, using the
887 # emulator from the ubuntu-ui-toolkit.
888 mm_option = units_selector.select_single(
889@@ -353,25 +416,33 @@
890 self._open_settings_sheet()
891
892 # open the value selector
893- self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='ServiceSelector'), Eventually(Not(Is(None))))
894- units_selector = self.main_view.select_single('OptionSelector', objectName="ServiceSelector")
895+ self.assertThat(lambda: self.main_view.select_single(
896+ 'OptionSelector', objectName='ServiceSelector'),
897+ Eventually(Not(Is(None))))
898+ units_selector = self.main_view.select_single(
899+ 'OptionSelector', objectName="ServiceSelector")
900 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
901- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
902- current_option = units_selector.select_many('OptionSelectorDelegate')[1]
903+ self.assertThat(lambda: units_selector.select_many(
904+ 'OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
905+ current_option = units_selector.select_many(
906+ 'OptionSelectorDelegate')[1]
907 self.pointing_device.click_object(current_option)
908
909 # choose second option, openweathermap
910 self._move_pointer_around()
911- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
912- second_option = units_selector.select_many('OptionSelectorDelegate')[0]
913+ self.assertThat(lambda: units_selector.select_many(
914+ 'OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
915+ second_option = units_selector.select_many(
916+ 'OptionSelectorDelegate')[0]
917 self.pointing_device.click_object(second_option)
918 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
919
920 # check if precipitation units selector appears
921- self.assertThat(lambda: self.main_view.select_single('OptionSelector',
922- objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None))))
923- units_selector = self.main_view.select_single('OptionSelector',
924- objectName="PrecipitationUnitsSelector")
925+ self.assertThat(lambda: self.main_view.select_single(
926+ 'OptionSelector', objectName='PrecipitationUnitsSelector'),
927+ Eventually(Not(Is(None))))
928+ units_selector = self.main_view.select_single(
929+ 'OptionSelector', objectName="PrecipitationUnitsSelector")
930 self.assertThat(units_selector.visible, Eventually(Equals(1)))
931 self._click_sheet_confirm()
932
933@@ -381,28 +452,35 @@
934
935 # switch back to metric values again
936 self._open_settings_sheet()
937- self.assertThat(lambda: self.main_view.select_single('OptionSelector', objectName='ServiceSelector'), Eventually(Not(Is(None))))
938- units_selector = self.main_view.select_single('OptionSelector', objectName="ServiceSelector")
939+ self.assertThat(lambda: self.main_view.select_single(
940+ 'OptionSelector', objectName='ServiceSelector'),
941+ Eventually(Not(Is(None))))
942+ units_selector = self.main_view.select_single(
943+ 'OptionSelector', objectName="ServiceSelector")
944 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
945- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
946- current_option = units_selector.select_many('OptionSelectorDelegate')[0]
947+ self.assertThat(lambda: units_selector.select_many(
948+ 'OptionSelectorDelegate')[0], Eventually(Not(Is(None))))
949+ current_option = units_selector.select_many(
950+ 'OptionSelectorDelegate')[0]
951 self.pointing_device.click_object(current_option)
952 # while it's opened, units_selector returns false
953 # self.assertThat(units_selector.expanded, Eventually(Equals(True)))
954
955 # click twc option
956 self._move_pointer_around()
957- self.assertThat(lambda: units_selector.select_many('OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
958+ self.assertThat(lambda: units_selector.select_many(
959+ 'OptionSelectorDelegate')[1], Eventually(Not(Is(None))))
960 first_option = units_selector.select_single(
961 'OptionSelectorDelegate', objectName='twcOption')
962 self.pointing_device.click_object(first_option)
963 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
964
965 # check if precipitation units selector disappears and confirm
966- self.assertThat(lambda: self.main_view.select_single('OptionSelector',
967- objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None))))
968- units_selector = self.main_view.select_single('OptionSelector',
969- objectName="PrecipitationUnitsSelector")
970+ self.assertThat(lambda: self.main_view.select_single(
971+ 'OptionSelector', objectName='PrecipitationUnitsSelector'),
972+ Eventually(Not(Is(None))))
973+ units_selector = self.main_view.select_single(
974+ 'OptionSelector', objectName="PrecipitationUnitsSelector")
975 self.assertThat(units_selector.visible, Eventually(Equals(0)))
976 self._click_sheet_confirm()
977

Subscribers

People subscribed via source and target branches