File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -40,12 +40,18 @@ async def test_client(addr):
40
40
await self .loop .sock_connect (sock , addr )
41
41
42
42
await self .loop .sock_sendall (sock , A_DATA )
43
- data = await self .loop .sock_recv (sock , 2 )
44
- self .assertEqual (data , b'OK' )
43
+
44
+ buf = b''
45
+ while len (buf ) != 2 :
46
+ buf += await self .loop .sock_recv (sock , 1 )
47
+ self .assertEqual (buf , b'OK' )
45
48
46
49
await self .loop .sock_sendall (sock , B_DATA )
47
- data = await self .loop .sock_recv (sock , 4 )
48
- self .assertEqual (data , b'SPAM' )
50
+
51
+ buf = b''
52
+ while len (buf ) != 4 :
53
+ buf += await self .loop .sock_recv (sock , 1 )
54
+ self .assertEqual (buf , b'SPAM' )
49
55
50
56
async def start_server ():
51
57
nonlocal CNT
Original file line number Diff line number Diff line change @@ -37,12 +37,18 @@ async def test_client(addr):
37
37
await self .loop .sock_connect (sock , addr )
38
38
39
39
await self .loop .sock_sendall (sock , b'AAAA' )
40
- data = await self .loop .sock_recv (sock , 2 )
41
- self .assertEqual (data , b'OK' )
40
+
41
+ buf = b''
42
+ while len (buf ) != 2 :
43
+ buf += await self .loop .sock_recv (sock , 1 )
44
+ self .assertEqual (buf , b'OK' )
42
45
43
46
await self .loop .sock_sendall (sock , b'BBBB' )
44
- data = await self .loop .sock_recv (sock , 4 )
45
- self .assertEqual (data , b'SPAM' )
47
+
48
+ buf = b''
49
+ while len (buf ) != 4 :
50
+ buf += await self .loop .sock_recv (sock , 1 )
51
+ self .assertEqual (buf , b'SPAM' )
46
52
47
53
async def start_server ():
48
54
nonlocal CNT
You can’t perform that action at this time.
0 commit comments