# Path: phial/errors.py
# class ArgumentValidationError(Exception):
#     """Exception indicating argument validation has failed."""
# 
#     pass
# 
# Path: phial/utils.py
# def validate_kwargs(func: Callable, kwargs: Dict[str, str]) -> Dict[str, Any]:
#     """Validate kwargs match a functions signature."""
#     func_params = signature(func).parameters
#     validated_kwargs: Dict[str, Any] = {}
#     for key in func_params.values():
#         value = None
#         if key.default is not Parameter.empty:
#             value = key.default
#         if value is None and key.name not in kwargs:
#             raise ArgumentValidationError(
#                 "Parameter {0} not provided to {1}".format(key.name, func.__name__)
#             )
#         elif key.name in kwargs:
#             value = kwargs[key.name]
# 
#         if key.annotation is not Signature.empty:
#             try:
#                 value = key.annotation(value)
#             except ValueError:
#                 raise ArgumentTypeValidationError(
#                     "{0} could not be converted to {1}".format(
#                         value, key.annotation.__name__
#                     )
#                 )
#         validated_kwargs[key.name] = value
#     return validated_kwargs


import pytest
from phial.errors import ArgumentValidationError
from phial.utils import validate_kwargs


def test_args_validation_errors_correctly() -> None:
    """Test args validation errors correctly."""

    def test(name: str) -> None:
        pass

    with pytest.raises(Exception) as e:
        validate_kwargs(test, {"age": "string"})
    assert e is not None


def test_args_type_validation_errors_correctly() -> None:
    """Test args type validation errors correctly."""

    def test(age: int) -> None:
        pass

    with pytest.raises(ArgumentValidationError) as e:
        validate_kwargs(test, {"age": "string"})
    assert e is not None


def test_validation_ignores_defaulted_kwargs_correctly() -> None:
    """Test validation ignores defaulted kwargs correctly."""

    def test(name: str, age: int = 5) -> None:
        pass


# Path: phial/errors.py
# class ArgumentValidationError(Exception):
#     """Exception indicating argument validation has failed."""
# 
#     pass
# 
# Path: phial/utils.py
# def validate_kwargs(func: Callable, kwargs: Dict[str, str]) -> Dict[str, Any]:
#     """Validate kwargs match a functions signature."""
#     func_params = signature(func).parameters
#     validated_kwargs: Dict[str, Any] = {}
#     for key in func_params.values():
#         value = None
#         if key.default is not Parameter.empty:
#             value = key.default
#         if value is None and key.name not in kwargs:
#             raise ArgumentValidationError(
#                 "Parameter {0} not provided to {1}".format(key.name, func.__name__)
#             )
#         elif key.name in kwargs:
#             value = kwargs[key.name]
# 
#         if key.annotation is not Signature.empty:
#             try:
#                 value = key.annotation(value)
#             except ValueError:
#                 raise ArgumentTypeValidationError(
#                     "{0} could not be converted to {1}".format(
#                         value, key.annotation.__name__
#                     )
#                 )
#         validated_kwargs[key.name] = value
#     return validated_kwargs


# Path: tests/utils/test_validate_kwargs.py
import pytest
from phial.errors import ArgumentValidationError
from phial.utils import validate_kwargs



def test_args_validation_errors_correctly() -> None:
    """Test args validation errors correctly."""

    def test(name: str) -> None:
        pass

    with pytest.raises(Exception) as e:
        validate_kwargs(test, {"age": "string"})
    assert e is not None


def test_args_type_validation_errors_correctly() -> None:
    """Test args type validation errors correctly."""

    def test(age: int) -> None:
        pass

    with pytest.raises(ArgumentValidationError) as e:
        validate_kwargs(test, {"age": "string"})
    assert e is not None


def test_validation_ignores_defaulted_kwargs_correctly() -> None:
    """Test validation ignores defaulted kwargs correctly."""

    def test(name: str, age: int = 5) -> None:
        pass


    args = validate_kwargs(test, {"name": "string"})