Skip to content

Commit 3829576

Browse files
committed
chapter 2 black
1 parent cb82dd9 commit 3829576

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

chapter_02_unittest.asciidoc

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ browser = webdriver.Firefox()
7878
7979
# Edith has heard about a cool new online to-do app. She goes
8080
# to check out its homepage
81-
browser.get('http://localhost:8000')
81+
browser.get("http://localhost:8000")
8282
8383
# She notices the page title and header mention to-do lists
84-
assert 'To-Do' in browser.title
84+
assert "To-Do" in browser.title
8585
8686
# She is invited to enter a to-do item straight away
8787
@@ -165,7 +165,7 @@ And then, in another shell, run the tests:
165165
$ pass:quotes[*python functional_tests.py*]
166166
Traceback (most recent call last):
167167
File "...python-tdd-book/functional_tests.py", line 10, in <module>
168-
assert 'To-Do' in browser.title
168+
assert "To-Do" in browser.title
169169
AssertionError
170170
----
171171
@@ -193,7 +193,7 @@ something like:
193193
[role="skipme"]
194194
[source,python]
195195
----
196-
assert 'To-Do' in browser.title, "Browser title was " + browser.title
196+
assert "To-Do" in browser.title, "Browser title was " + browser.title
197197
----
198198

199199
And we could also use a `try/finally` to clean up the old Firefox window. But
@@ -209,27 +209,28 @@ use that! In [keep-together]#_functional_tests.py_#:
209209
from selenium import webdriver
210210
import unittest
211211
212-
class NewVisitorTest(unittest.TestCase): #<1>
213212
214-
def setUp(self): #<3>
213+
class NewVisitorTest(unittest.TestCase): # <1>
214+
def setUp(self): # <3>
215215
self.browser = webdriver.Firefox()
216216
217-
def tearDown(self): #<3>
217+
def tearDown(self): # <3>
218218
self.browser.quit()
219219
220-
def test_can_start_a_list_and_retrieve_it_later(self): #<2>
220+
def test_can_start_a_list_and_retrieve_it_later(self): # <2>
221221
# Edith has heard about a cool new online to-do app. She goes
222222
# to check out its homepage
223-
self.browser.get('http://localhost:8000')
223+
self.browser.get("http://localhost:8000")
224224
225225
# She notices the page title and header mention to-do lists
226-
self.assertIn('To-Do', self.browser.title) #<4>
227-
self.fail('Finish the test!') #<5>
226+
self.assertIn("To-Do", self.browser.title) # <4>
227+
self.fail("Finish the test!") # <5>
228228
229229
# She is invited to enter a to-do item straight away
230230
[...rest of comments as before]
231231
232-
if __name__ == '__main__': #<6>
232+
233+
if __name__ == "__main__": # <6>
233234
unittest.main()
234235
----
235236
====
@@ -289,7 +290,7 @@ FAIL: test_can_start_a_list_and_retrieve_it_later
289290
Traceback (most recent call last):
290291
File "...python-tdd-book/functional_tests.py", line 18, in
291292
test_can_start_a_list_and_retrieve_it_later
292-
self.assertIn('To-Do', self.browser.title)
293+
self.assertIn("To-Do", self.browser.title)
293294
AssertionError: 'To-Do' not found in 'The install worked successfully!
294295
Congratulations!'
295296
@@ -335,10 +336,10 @@ index d333591..b0f22dc 100644
335336
+import unittest
336337
337338
-browser = webdriver.Firefox()
338-
-browser.get('http://localhost:8000')
339+
-browser.get("http://localhost:8000")
339340
+class NewVisitorTest(unittest.TestCase):
340341
341-
-assert 'Django' in browser.title
342+
-assert "Django" in browser.title
342343
+ def setUp(self):
343344
+ self.browser = webdriver.Firefox()
344345
+

0 commit comments

Comments
 (0)