# Path: aiosmtplib/api.py
# @overload
# async def send(
#     message: Union[email.message.EmailMessage, email.message.Message],
#     sender: Optional[str] = ...,
#     recipients: Optional[Union[str, Sequence[str]]] = ...,
#     hostname: str = ...,
#     port: Optional[int] = ...,
#     username: Optional[Union[str, bytes]] = ...,
#     password: Optional[Union[str, bytes]] = ...,
#     mail_options: Optional[List[str]] = ...,
#     rcpt_options: Optional[List[str]] = ...,
#     timeout: Optional[float] = ...,
#     source_address: Optional[str] = ...,
#     use_tls: bool = ...,
#     start_tls: bool = ...,
#     validate_certs: bool = ...,
#     client_cert: Optional[str] = ...,
#     client_key: Optional[str] = ...,
#     tls_context: None = ...,
#     cert_bundle: Optional[str] = ...,
#     socket_path: None = ...,
#     sock: None = ...,
# ) -> Tuple[Dict[str, SMTPResponse], str]:
#     ...


import pytest
from aiosmtplib import send
):
    errors, response = await send(
        bytes(message_str, "ascii"),
        hostname=hostname,
        port=smtpd_server_port,
        sender=sender_str,
        recipients=[recipient_str],
    )

    assert not errors
    assert len(received_messages) == 1


async def test_send_without_sender(
    hostname, smtpd_server_port, recipient_str, message_str, received_messages
):
    with pytest.raises(ValueError):
        errors, response = await send(
            message_str,
            hostname=hostname,
            port=smtpd_server_port,
            sender=None,
            recipients=[recipient_str],
        )


async def test_send_without_recipients(
    hostname, smtpd_server_port, sender_str, message_str, received_messages
):
    with pytest.raises(ValueError):

# Path: aiosmtplib/api.py
# @overload
# async def send(
#     message: Union[email.message.EmailMessage, email.message.Message],
#     sender: Optional[str] = ...,
#     recipients: Optional[Union[str, Sequence[str]]] = ...,
#     hostname: str = ...,
#     port: Optional[int] = ...,
#     username: Optional[Union[str, bytes]] = ...,
#     password: Optional[Union[str, bytes]] = ...,
#     mail_options: Optional[List[str]] = ...,
#     rcpt_options: Optional[List[str]] = ...,
#     timeout: Optional[float] = ...,
#     source_address: Optional[str] = ...,
#     use_tls: bool = ...,
#     start_tls: bool = ...,
#     validate_certs: bool = ...,
#     client_cert: Optional[str] = ...,
#     client_key: Optional[str] = ...,
#     tls_context: None = ...,
#     cert_bundle: Optional[str] = ...,
#     socket_path: None = ...,
#     sock: None = ...,
# ) -> Tuple[Dict[str, SMTPResponse], str]:
#     ...


# Path: tests/test_api.py
import pytest
from aiosmtplib import send

):
    errors, response = await send(
        bytes(message_str, "ascii"),
        hostname=hostname,
        port=smtpd_server_port,
        sender=sender_str,
        recipients=[recipient_str],
    )

    assert not errors
    assert len(received_messages) == 1


async def test_send_without_sender(
    hostname, smtpd_server_port, recipient_str, message_str, received_messages
):
    with pytest.raises(ValueError):
        errors, response = await send(
            message_str,
            hostname=hostname,
            port=smtpd_server_port,
            sender=None,
            recipients=[recipient_str],
        )


async def test_send_without_recipients(
    hostname, smtpd_server_port, sender_str, message_str, received_messages
):
    with pytest.raises(ValueError):

        errors, response = await send(