# Path: thrifty/setting_parsers.py
# _FLOAT_REGEX = r'[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?'
# _RANGE_REGEX = r'\s*-\s*'
# _FREQ_MAG_REGEX = r'[kKmM]?'
# _HERTZ_REGEX = r'[hH][zZ]'
# _FREQ_RANGE_PATTERN = re.compile(r'^({0})(?:{1}({0}))?\s*({2})({3})?$'.format(
#     _FLOAT_REGEX, _RANGE_REGEX, _FREQ_MAG_REGEX, _HERTZ_REGEX), re.IGNORECASE)
# _THRESHOLD_SYMBOL = r'constant|c|snr|s|stddev|d|'
# _THRESHOLD_TERM = r'^\s*(?=\S)(?:({0})\s*\*?\s*)?({1})\s*$'.format(
#     _FLOAT_REGEX, _THRESHOLD_SYMBOL)
# _SI_PREFIXES = {
#     'y': 1e-24,  # yocto
#     'z': 1e-21,  # zepto
#     'a': 1e-18,  # atto
#     'f': 1e-15,  # femto
#     'p': 1e-12,  # pico
#     'n': 1e-9,   # nano
#     'u': 1e-6,   # micro
#     'm': 1e-3,   # mili
#     'c': 1e-2,   # centi
#     'd': 1e-1,   # deci
#     'k': 1e3,    # kilo
#     'M': 1e6,    # mega
#     'G': 1e9,    # giga
#     'T': 1e12,   # tera
#     'P': 1e15,   # peta
#     'E': 1e18,   # exa
#     'Z': 1e21,   # zetta
#     'Y': 1e24,   # yotta
# }
# def metric_float(string):
# def freq_range(string):
# def normalize_freq_range(range_, bin_freq):
# def threshold(string):


import pytest
from thrifty import setting_parsers




def test_freq_range():
    """Test freq_range parser with valid values"""
    tests = [
        ('100', (100.0, 100.0, False)),
        ('-123.4', (-123.4, -123.4, False)),
        ('100-200', (100.0, 200.0, False)),
        ('10e1 - 20e1', (100.0, 200.0, False)),
        ('-100-100', (-100.0, 100.0, False)),
        ('-200--100', (-200.0, -100.0, False)),
        ('-200--100', (-200.0, -100.0, False)),
        ('100hz', (100.0, 100.0, True)),
        ('100-200 Hz', (100.0, 200.0, True)),
        ('10-20 khz', (10000.0, 20000.0, True)),
        ('1.2345-2.3456 KHZ', (1.2345e3, 2.3456e3, True)),
        ('433-435Mhz', (433e6, 435e6, True)),
        ('1.2345-2.3456 mhz', (1.2345e6, 2.3456e6, True)),
    ]
    for string, expected in tests:
        assert setting_parsers.freq_range(string) == expected


def test_freq_range_exceptions():
    """Test freq_range parser with invalid values"""
    tests = ['garbage']
    for test in tests:
        with pytest.raises(ValueError):

# Path: thrifty/setting_parsers.py
# _FLOAT_REGEX = r'[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?'
# _RANGE_REGEX = r'\s*-\s*'
# _FREQ_MAG_REGEX = r'[kKmM]?'
# _HERTZ_REGEX = r'[hH][zZ]'
# _FREQ_RANGE_PATTERN = re.compile(r'^({0})(?:{1}({0}))?\s*({2})({3})?$'.format(
#     _FLOAT_REGEX, _RANGE_REGEX, _FREQ_MAG_REGEX, _HERTZ_REGEX), re.IGNORECASE)
# _THRESHOLD_SYMBOL = r'constant|c|snr|s|stddev|d|'
# _THRESHOLD_TERM = r'^\s*(?=\S)(?:({0})\s*\*?\s*)?({1})\s*$'.format(
#     _FLOAT_REGEX, _THRESHOLD_SYMBOL)
# _SI_PREFIXES = {
#     'y': 1e-24,  # yocto
#     'z': 1e-21,  # zepto
#     'a': 1e-18,  # atto
#     'f': 1e-15,  # femto
#     'p': 1e-12,  # pico
#     'n': 1e-9,   # nano
#     'u': 1e-6,   # micro
#     'm': 1e-3,   # mili
#     'c': 1e-2,   # centi
#     'd': 1e-1,   # deci
#     'k': 1e3,    # kilo
#     'M': 1e6,    # mega
#     'G': 1e9,    # giga
#     'T': 1e12,   # tera
#     'P': 1e15,   # peta
#     'E': 1e18,   # exa
#     'Z': 1e21,   # zetta
#     'Y': 1e24,   # yotta
# }
# def metric_float(string):
# def freq_range(string):
# def normalize_freq_range(range_, bin_freq):
# def threshold(string):


# Path: tests/test_setting_parsers.py
import pytest
from thrifty import setting_parsers





def test_freq_range():
    """Test freq_range parser with valid values"""
    tests = [
        ('100', (100.0, 100.0, False)),
        ('-123.4', (-123.4, -123.4, False)),
        ('100-200', (100.0, 200.0, False)),
        ('10e1 - 20e1', (100.0, 200.0, False)),
        ('-100-100', (-100.0, 100.0, False)),
        ('-200--100', (-200.0, -100.0, False)),
        ('-200--100', (-200.0, -100.0, False)),
        ('100hz', (100.0, 100.0, True)),
        ('100-200 Hz', (100.0, 200.0, True)),
        ('10-20 khz', (10000.0, 20000.0, True)),
        ('1.2345-2.3456 KHZ', (1.2345e3, 2.3456e3, True)),
        ('433-435Mhz', (433e6, 435e6, True)),
        ('1.2345-2.3456 mhz', (1.2345e6, 2.3456e6, True)),
    ]
    for string, expected in tests:
        assert setting_parsers.freq_range(string) == expected


def test_freq_range_exceptions():
    """Test freq_range parser with invalid values"""
    tests = ['garbage']
    for test in tests:
        with pytest.raises(ValueError):

            setting_parsers.freq_range(test)