# Path: aiobotocore/response.py
# class AioReadTimeoutError(ReadTimeoutError, asyncio.TimeoutError):
# class StreamingBody(wrapt.ObjectProxy):
#     _DEFAULT_CHUNK_SIZE = 1024
#     def __init__(self, raw_stream, content_length):
#     async def __aenter__(self):
#     async def __aexit__(self, exc_type, exc_val, exc_tb):
#     def tell(self):
#     async def read(self, amt=None):
#     def __aiter__(self):
#     async def __anext__(self):
#     async def iter_lines(self, chunk_size=1024, keepends=False):
#     async def iter_chunks(self, chunk_size=_DEFAULT_CHUNK_SIZE):
#     def _verify_content_length(self):
# async def get_response(operation_model, http_response):


import io
import pytest
from aiobotocore import response
from botocore.exceptions import IncompleteReadError

@pytest.mark.moto
@pytest.mark.asyncio
async def test_streaming_line_iter_chunk_sizes():
    for chunk_size in range(1, 30):
        body = AsyncBytesIO(b'1234567890\n1234567890\n12345')
        stream = response.StreamingBody(body, content_length=27)
        await assert_lines(
            stream.iter_lines(chunk_size),
            [b'1234567890', b'1234567890', b'12345'],
        )


@pytest.mark.moto
@pytest.mark.asyncio
async def test_streaming_body_is_an_iterator():
    body = AsyncBytesIO(b'a' * 1024 + b'b' * 1024 + b'c' * 2)
    stream = response.StreamingBody(body, content_length=2050)
    assert b'a' * 1024 == await stream.__anext__()
    assert b'b' * 1024 == await stream.__anext__()
    assert b'c' * 2 == await stream.__anext__()
    with pytest.raises(StopAsyncIteration):
        await stream.__anext__()


@pytest.mark.moto
@pytest.mark.asyncio
async def test_streaming_line_abstruse_newline_standard():
    for chunk_size in range(1, 30):
        body = AsyncBytesIO(b'1234567890\r\n1234567890\r\n12345\r\n')

# Path: aiobotocore/response.py
# class AioReadTimeoutError(ReadTimeoutError, asyncio.TimeoutError):
# class StreamingBody(wrapt.ObjectProxy):
#     _DEFAULT_CHUNK_SIZE = 1024
#     def __init__(self, raw_stream, content_length):
#     async def __aenter__(self):
#     async def __aexit__(self, exc_type, exc_val, exc_tb):
#     def tell(self):
#     async def read(self, amt=None):
#     def __aiter__(self):
#     async def __anext__(self):
#     async def iter_lines(self, chunk_size=1024, keepends=False):
#     async def iter_chunks(self, chunk_size=_DEFAULT_CHUNK_SIZE):
#     def _verify_content_length(self):
# async def get_response(operation_model, http_response):


# Path: tests/test_response.py
import io
import pytest
from aiobotocore import response
from botocore.exceptions import IncompleteReadError


@pytest.mark.moto
@pytest.mark.asyncio
async def test_streaming_line_iter_chunk_sizes():
    for chunk_size in range(1, 30):
        body = AsyncBytesIO(b'1234567890\n1234567890\n12345')
        stream = response.StreamingBody(body, content_length=27)
        await assert_lines(
            stream.iter_lines(chunk_size),
            [b'1234567890', b'1234567890', b'12345'],
        )


@pytest.mark.moto
@pytest.mark.asyncio
async def test_streaming_body_is_an_iterator():
    body = AsyncBytesIO(b'a' * 1024 + b'b' * 1024 + b'c' * 2)
    stream = response.StreamingBody(body, content_length=2050)
    assert b'a' * 1024 == await stream.__anext__()
    assert b'b' * 1024 == await stream.__anext__()
    assert b'c' * 2 == await stream.__anext__()
    with pytest.raises(StopAsyncIteration):
        await stream.__anext__()


@pytest.mark.moto
@pytest.mark.asyncio
async def test_streaming_line_abstruse_newline_standard():
    for chunk_size in range(1, 30):
        body = AsyncBytesIO(b'1234567890\r\n1234567890\r\n12345\r\n')

        stream = response.StreamingBody(body, content_length=31)