async def test_connection_wait_closed_exceptions(rw_pairs_with_data): r, w = rw_pairs_with_data(b"some_data") w.wait_closed.side_effect = ConnectionError connection = Connection(r, w) connection.close() await connection.wait_closed() r, w = rw_pairs_with_data(b"some_data") w.wait_closed.side_effect = TimeoutError connection = Connection(r, w) connection.close() await connection.wait_closed()
async def test_connection_closes(rw_pairs_with_data): r, w = rw_pairs_with_data(b"G/1/foo\0") connection = Connection(r, w) connection.close() w.transport.abort.assert_called()