"""Tests for typed JSON-RPC client transfer exceptions.

Author: Vasiliy Zdanovskiy
email: vasilyvz@gmail.com
"""

from __future__ import annotations

from mcp_proxy_adapter.client.jsonrpc_client.exceptions import (
    ClientError,
    TransferChecksumMismatchClientError,
    TransferClientError,
    TransferCompressionClientError,
    TransferExpiredClientError,
    TransferRangeNotSatisfiableClientError,
    TransferResumeConflictClientError,
    TransferSessionNotFoundClientError,
    TransferTooLargeClientError,
)


def test_transfer_client_error_base_fields() -> None:
    exc = TransferClientError("x", details={"a": 1})
    assert str(exc) == "x"
    assert exc.details == {"a": 1}


def test_specific_transfer_exceptions_inherit_from_client_error() -> None:
    mapping = [
        TransferSessionNotFoundClientError("n", {}),
        TransferResumeConflictClientError("r", {}),
        TransferChecksumMismatchClientError("c", {}),
        TransferCompressionClientError("p", {}),
        TransferTooLargeClientError("t", {}),
        TransferRangeNotSatisfiableClientError("g", {}),
        TransferExpiredClientError("e", {}),
    ]
    for exc in mapping:
        assert isinstance(exc, TransferClientError)
        assert isinstance(exc, ClientError)
