# Path: pyjob/misc.py
# def typecast(value):
#     """Recursively typecast an input
# 
#     Parameters
#     ----------
#     value : int, float, str, tuple, list
# 
#     """
#     if isinstance(value, (dict, list)):
#         iterator = range(len(value)) if isinstance(value, list) else value
#         for i in iterator:
#             value[i] = typecast(value[i])
#     elif value == "None":
#         return None
#     elif value in ("False", "True"):
#         return True if value == "True" else False
#     else:
#         for type_fn in (int, float, str):
#             try:
#                 return type_fn(value)
#             except ValueError:
#                 pass
#     return value


from pyjob.misc import typecast


class TestTypecast(object):
    def test_int(self):
        output = typecast("1")
        assert isinstance(output, int)
        assert output == 1

    def test_float(self):
        output = typecast("1.0")
        assert isinstance(output, float)
        assert output == 1

    def test_char(self):
        output = typecast("a")

# Path: pyjob/misc.py
# def typecast(value):
#     """Recursively typecast an input
# 
#     Parameters
#     ----------
#     value : int, float, str, tuple, list
# 
#     """
#     if isinstance(value, (dict, list)):
#         iterator = range(len(value)) if isinstance(value, list) else value
#         for i in iterator:
#             value[i] = typecast(value[i])
#     elif value == "None":
#         return None
#     elif value in ("False", "True"):
#         return True if value == "True" else False
#     else:
#         for type_fn in (int, float, str):
#             try:
#                 return type_fn(value)
#             except ValueError:
#                 pass
#     return value


# Path: pyjob/tests/test_misc.py
from pyjob.misc import typecast



class TestTypecast(object):
    def test_int(self):
        output = typecast("1")
        assert isinstance(output, int)
        assert output == 1

    def test_float(self):
        output = typecast("1.0")
        assert isinstance(output, float)
        assert output == 1

    def test_char(self):
        output = typecast("a")

        assert isinstance(output, str)