1010
1111
1212def setup_module (module ):
13- engine = sqlalchemy .create_engine (' sqlite:///:memory:' )
13+ engine = sqlalchemy .create_engine (" sqlite:///:memory:" )
1414 Session .configure (bind = engine )
1515 Base .metadata .create_all (engine )
1616
@@ -21,7 +21,7 @@ def setup_module(module):
2121def test_documents ():
2222 c = Client (App ())
2323
24- collection_response = c .get (' /documents' )
24+ collection_response = c .get (" /documents" )
2525
2626 assert collection_response .json ["documents" ] == []
2727 assert "http://localhost/documents/add" in collection_response .json ["add" ]
@@ -33,22 +33,21 @@ def test_add_submit():
3333 c = Client (App ())
3434
3535 response = c .post (
36- '/documents/add_submit' ,
37- {'title' : 'My Title' , 'content' : 'My Content' }
36+ "/documents/add_submit" , {"title" : "My Title" , "content" : "My Content" }
3837 )
3938
40- assert response .body == b' <p>Awesome 1</p>'
39+ assert response .body == b" <p>Awesome 1</p>"
4140
4241
4342def test_document ():
4443 c = Client (App ())
4544
46- response = c .get (' /documents/1' )
45+ response = c .get (" /documents/1" )
4746 new_document_response = {
4847 "id" : 1 ,
4948 "title" : "My Title" ,
5049 "content" : "My Content" ,
51- "link" : "http://localhost/documents/1"
50+ "link" : "http://localhost/documents/1" ,
5251 }
5352
5453 assert response .json == new_document_response
@@ -57,15 +56,17 @@ def test_document():
5756def test_previous_next ():
5857 c = Client (App ())
5958
60- c .post (' /documents/add_submit' , {' title' : ' Two' , ' content' : ' Secundus' })
59+ c .post (" /documents/add_submit" , {" title" : " Two" , " content" : " Secundus" })
6160
62- response = c .get ('/documents/?limit=1&offset=0' )
63- expected_documents = [{
64- "id" : 1 ,
65- "title" : "My Title" ,
66- "content" : "My Content" ,
67- "link" : "http://localhost/documents/1"
68- }]
61+ response = c .get ("/documents/?limit=1&offset=0" )
62+ expected_documents = [
63+ {
64+ "id" : 1 ,
65+ "title" : "My Title" ,
66+ "content" : "My Content" ,
67+ "link" : "http://localhost/documents/1" ,
68+ }
69+ ]
6970
7071 assert response .json ["documents" ] == expected_documents
7172 assert "http://localhost/documents/add" in response .json ["add" ]
@@ -74,13 +75,15 @@ def test_previous_next():
7475 assert "limit=1" in response .json ["next" ]
7576 assert "offset=1" in response .json ["next" ]
7677
77- response = c .get ('/documents/?limit=1&offset=1' )
78- expected_documents = [{
79- "id" : 2 ,
80- "title" : "Two" ,
81- "content" : "Secundus" ,
82- "link" : "http://localhost/documents/2"
83- }]
78+ response = c .get ("/documents/?limit=1&offset=1" )
79+ expected_documents = [
80+ {
81+ "id" : 2 ,
82+ "title" : "Two" ,
83+ "content" : "Secundus" ,
84+ "link" : "http://localhost/documents/2" ,
85+ }
86+ ]
8487
8588 assert response .json ["documents" ] == expected_documents
8689 assert "http://localhost/documents/add" in response .json ["add" ]
@@ -93,9 +96,9 @@ def test_previous_next():
9396def test_add ():
9497 c = Client (App ())
9598
96- response = c .get (' /documents/add' )
99+ response = c .get (" /documents/add" )
97100
98- expected_response = b''' \
101+ expected_response = b""" \
99102 <html>
100103<body>
101104<form action="/documents/add_submit" method="POST">
@@ -105,12 +108,12 @@ def test_add():
105108</form>
106109</body>
107110</html>
108- '''
111+ """
109112
110113 assert response .body == expected_response
111114
112115
113116def test_root ():
114117 c = Client (App ())
115118
116- c .get ('/' , status = 302 )
119+ c .get ("/" , status = 302 )
0 commit comments