async def test_udpsession_cancel_operation(fake_udp_socket_manager): session = UdpTrackerSession("127.0.0.1", ("localhost", 8475), "/announce", 0, None, fake_udp_socket_manager) task = ensure_future(session.connect_to_tracker()) with pytest.raises(CancelledError): task.cancel() await task await session.cleanup()
async def test_udpsession_cancel_operation(self): session = UdpTrackerSession("127.0.0.1", ("localhost", 8475), "/announce", 0, self.socket_mgr) task = ensure_future(session.connect_to_tracker()) with self.assertRaises(CancelledError): task.cancel() await task await session.cleanup()