# Path: rvic/core/config.py
# def config_type(value):
#     '''
#     Parse the type of the configuration file option.
#     First see the value is a bool, then try float, finally return a string.
#     '''
#     val_list = [x.strip() for x in value.split(',')]
#     if len(val_list) == 1:
#         value = val_list[0]
#         if value in ['true', 'True', 'TRUE', 'T']:
#             return True
#         elif value in ['false', 'False', 'FALSE', 'F']:
#             return False
#         elif value in ['none', 'None', 'NONE', '']:
#             return None
#         elif isint(value):
#             return int(value)
#         elif isfloat(value):
#             return float(value)
#         else:
#             return os.path.expandvars(value)
#     else:
#         try:
#             return list(map(float, val_list))
#         except (TypeError, ValueError):
#             pass
#         try:
#             return list(map(int, val_list))
#         except (TypeError, ValueError):
#             return val_list
# 
# def isfloat(x):
#     '''Test if value is a float'''
#     try:
#         float(x)
#     except ValueError:
#         return False
#     else:
#         return True
# 
# def isint(x):
#     '''Test if value is an integer'''
#     try:
#         a = float(x)
#         b = int(a)
#     except ValueError:
#         return False
#     else:
#         return a == b


from rvic.core.config import config_type, isfloat, isint


def test_config_type_int():
    assert config_type('1') == 1


def test_config_type_float():
    assert config_type('1.75') == 1.75


def test_config_type_bool():
    assert config_type('True')


def test_isfloat():
    assert isfloat(4.3)
    assert isfloat('4.3')


def test_isint():
    assert isint(4)
    assert isint('4')
    assert not isint(4.3)

# Path: rvic/core/config.py
# def config_type(value):
#     '''
#     Parse the type of the configuration file option.
#     First see the value is a bool, then try float, finally return a string.
#     '''
#     val_list = [x.strip() for x in value.split(',')]
#     if len(val_list) == 1:
#         value = val_list[0]
#         if value in ['true', 'True', 'TRUE', 'T']:
#             return True
#         elif value in ['false', 'False', 'FALSE', 'F']:
#             return False
#         elif value in ['none', 'None', 'NONE', '']:
#             return None
#         elif isint(value):
#             return int(value)
#         elif isfloat(value):
#             return float(value)
#         else:
#             return os.path.expandvars(value)
#     else:
#         try:
#             return list(map(float, val_list))
#         except (TypeError, ValueError):
#             pass
#         try:
#             return list(map(int, val_list))
#         except (TypeError, ValueError):
#             return val_list
# 
# def isfloat(x):
#     '''Test if value is a float'''
#     try:
#         float(x)
#     except ValueError:
#         return False
#     else:
#         return True
# 
# def isint(x):
#     '''Test if value is an integer'''
#     try:
#         a = float(x)
#         b = int(a)
#     except ValueError:
#         return False
#     else:
#         return a == b


# Path: tests/unit/test_config.py
from rvic.core.config import config_type, isfloat, isint



def test_config_type_int():
    assert config_type('1') == 1


def test_config_type_float():
    assert config_type('1.75') == 1.75


def test_config_type_bool():
    assert config_type('True')


def test_isfloat():
    assert isfloat(4.3)
    assert isfloat('4.3')


def test_isint():
    assert isint(4)
    assert isint('4')
    assert not isint(4.3)

    assert not isint('4.3')