diff --git a/radicli/tests/test_util.py b/radicli/tests/test_util.py index fb2d61c..580050c 100644 --- a/radicli/tests/test_util.py +++ b/radicli/tests/test_util.py @@ -5,7 +5,7 @@ from uuid import UUID import pytest import shutil -from radicli.util import stringify_type, get_list_converter +from radicli.util import stringify_type, get_list_converter, get_arg, Arg _KindT = TypeVar("_KindT", bound=Union[str, int, float, Path]) @@ -61,3 +61,13 @@ def test_stringify_type(arg_type, expected): def test_get_list_converter(item_type, value, expected): converter = get_list_converter(item_type) assert converter(value) == expected + +def test_get_arg_string_type(): + arg_info = Arg() + result = get_arg("test_param", arg_info, "str") + assert result.type is str + +def test_get_arg_regular_type(): + arg_info = Arg() + result = get_arg("test_param", arg_info, int) + assert result.type is int \ No newline at end of file diff --git a/radicli/util.py b/radicli/util.py index 32abe97..500338a 100644 --- a/radicli/util.py +++ b/radicli/util.py @@ -296,6 +296,9 @@ def get_arg( skip_resolve: bool = False, ) -> ArgparseArg: """Generate an argument to add to argparse and interpret types if possible.""" + if isinstance(param_type, str): + # Windows may pass param_types as str + param_type = BASE_TYPES_MAP.get(param_type, None) arg = ArgparseArg( id=param, arg=orig_arg,