1313class AioHttpEntryTestCase (TestCase ):
1414 @mocketize
1515 def test_http_session (self ):
16- url = ' http://httpbin.org/ip'
16+ url = " http://httpbin.org/ip"
1717 body = "asd" * 100
1818 Entry .single_register (Entry .GET , url , body = body , status = 404 )
19- Entry .single_register (Entry .POST , url , body = body * 2 , status = 201 )
19+ Entry .single_register (Entry .POST , url , body = body * 2 , status = 201 )
2020
21- async def main (l ):
22- async with aiohttp .ClientSession (loop = l ) as session :
21+ async def main (_loop ):
22+ async with aiohttp .ClientSession (loop = _loop ) as session :
2323 with async_timeout .timeout (3 ):
2424 async with session .get (url ) as get_response :
2525 assert get_response .status == 404
@@ -29,7 +29,7 @@ async def main(l):
2929 async with session .post (url , data = body * 6 ) as post_response :
3030 assert post_response .status == 201
3131 assert await post_response .text () == body * 2
32- assert Mocket .last_request ().method == ' POST'
32+ assert Mocket .last_request ().method == " POST"
3333 assert Mocket .last_request ().body == body * 6
3434
3535 loop = asyncio .get_event_loop ()
@@ -39,13 +39,13 @@ async def main(l):
3939
4040 @mocketize
4141 def test_https_session (self ):
42- url = ' https://httpbin.org/ip'
42+ url = " https://httpbin.org/ip"
4343 body = "asd" * 100
4444 Entry .single_register (Entry .GET , url , body = body , status = 404 )
45- Entry .single_register (Entry .POST , url , body = body * 2 , status = 201 )
45+ Entry .single_register (Entry .POST , url , body = body * 2 , status = 201 )
4646
47- async def main (l ):
48- async with aiohttp .ClientSession (loop = l ) as session :
47+ async def main (_loop ):
48+ async with aiohttp .ClientSession (loop = _loop ) as session :
4949 with async_timeout .timeout (3 ):
5050 async with session .get (url ) as get_response :
5151 assert get_response .status == 404
@@ -63,19 +63,20 @@ async def main(l):
6363
6464 @httprettified
6565 def test_httprettish_session (self ):
66- url = ' https://httpbin.org/ip'
66+ url = " https://httpbin.org/ip"
6767 HTTPretty .register_uri (
6868 HTTPretty .GET ,
6969 url ,
70- body = json .dumps (dict (origin = ' 127.0.0.1' )),
70+ body = json .dumps (dict (origin = " 127.0.0.1" )),
7171 )
7272
73- async def main (l ):
74- async with aiohttp .ClientSession (loop = l ) as session :
73+ async def main (_loop ):
74+ async with aiohttp .ClientSession (loop = _loop ) as session :
7575 with async_timeout .timeout (3 ):
7676 async with session .get (url ) as get_response :
7777 assert get_response .status == 200
7878 assert await get_response .text () == '{"origin": "127.0.0.1"}'
79+
7980 loop = asyncio .get_event_loop ()
8081 loop .set_debug (True )
8182 loop .run_until_complete (main (loop ))
0 commit comments