@@ -892,6 +892,15 @@ async def test_acknowledge_ping(self):
892
892
async with asyncio_timeout (MS ):
893
893
await pong_waiter
894
894
895
+ async def test_acknowledge_canceled_ping (self ):
896
+ """ping is acknowledged by a pong with the same payload after being canceled."""
897
+ async with self .drop_frames_rcvd (): # drop automatic response to ping
898
+ pong_waiter = await self .connection .ping ("this" )
899
+ pong_waiter .cancel ()
900
+ await self .remote_connection .pong ("this" )
901
+ with self .assertRaises (asyncio .CancelledError ):
902
+ await pong_waiter
903
+
895
904
async def test_acknowledge_ping_non_matching_pong (self ):
896
905
"""ping isn't acknowledged by a pong with a different payload."""
897
906
async with self .drop_frames_rcvd (): # drop automatic response to ping
@@ -902,14 +911,26 @@ async def test_acknowledge_ping_non_matching_pong(self):
902
911
await pong_waiter
903
912
904
913
async def test_acknowledge_previous_ping (self ):
905
- """ping is acknowledged by a pong with the same payload as a later ping."""
914
+ """ping is acknowledged by a pong for a later ping."""
906
915
async with self .drop_frames_rcvd (): # drop automatic response to ping
907
916
pong_waiter = await self .connection .ping ("this" )
908
917
await self .connection .ping ("that" )
909
918
await self .remote_connection .pong ("that" )
910
919
async with asyncio_timeout (MS ):
911
920
await pong_waiter
912
921
922
+ async def test_acknowledge_previous_canceled_ping (self ):
923
+ """ping is acknowledged by a pong for a later ping after being canceled."""
924
+ async with self .drop_frames_rcvd (): # drop automatic response to ping
925
+ pong_waiter = await self .connection .ping ("this" )
926
+ pong_waiter_2 = await self .connection .ping ("that" )
927
+ pong_waiter .cancel ()
928
+ await self .remote_connection .pong ("that" )
929
+ async with asyncio_timeout (MS ):
930
+ await pong_waiter_2
931
+ with self .assertRaises (asyncio .CancelledError ):
932
+ await pong_waiter
933
+
913
934
async def test_ping_duplicate_payload (self ):
914
935
"""ping rejects the same payload until receiving the pong."""
915
936
async with self .drop_frames_rcvd (): # drop automatic response to ping
0 commit comments