Exemplo n.º 1
0
def test_targets_row_to_params_defaults():
    column = 'income'
    target = 100000
    metric = 'mean'
    filters = np.nan
    clip_low = np.nan
    clip_high = np.nan
    int_result = np.nan

    row = pd.Series(
        [column, target, metric, filters, clip_low, clip_high, int_result],
        index=[
            'column_name', 'target_value', 'target_metric', 'filters',
            'clip_low', 'clip_high', 'int_result'
        ])

    r = scl._targets_row_to_params(row)

    assert r.column == column
    assert r.target == target
    assert r.metric == metric
    assert r.filters is None
    assert r.clip_low is None
    assert r.clip_high is None
    assert r.int_result is False
Exemplo n.º 2
0
def test_targets_row_to_params():
    column = 'income'
    target = 100000
    metric = 'mean'
    filters = 'geo_id == "a",filter_col < 106'
    clip_low = 400
    clip_high = 999.9
    int_result = True

    row = pd.Series(
        [column, target, metric, filters, clip_low, clip_high, int_result],
        index=[
            'column_name', 'target_value', 'target_metric', 'filters',
            'clip_low', 'clip_high', 'int_result'
        ])

    r = scl._targets_row_to_params(row)

    assert r.column == column
    assert r.target == target
    assert r.metric == metric
    assert r.filters == ['geo_id == "a"', 'filter_col < 106']
    assert r.clip_low == clip_low
    assert r.clip_high == clip_high
    assert r.int_result == int_result
Exemplo n.º 3
0
def test_targets_row_to_params_defaults():
    column = 'income'
    target = 100000
    metric = 'mean'
    filters = np.nan
    clip_low = np.nan
    clip_high = np.nan
    int_result = np.nan

    row = pd.Series(
        [column, target, metric, filters, clip_low, clip_high, int_result],
        index=[
            'column_name', 'target_value', 'target_metric', 'filters',
            'clip_low', 'clip_high', 'int_result'])

    r = scl._targets_row_to_params(row)

    assert r.column == column
    assert r.target == target
    assert r.metric == metric
    assert r.filters is None
    assert r.clip_low is None
    assert r.clip_high is None
    assert r.int_result is False
Exemplo n.º 4
0
def test_targets_row_to_params():
    column = 'income'
    target = 100000
    metric = 'mean'
    filters = 'geo_id == "a",filter_col < 106'
    clip_low = 400
    clip_high = 999.9
    int_result = True

    row = pd.Series(
        [column, target, metric, filters, clip_low, clip_high, int_result],
        index=[
            'column_name', 'target_value', 'target_metric', 'filters',
            'clip_low', 'clip_high', 'int_result'])

    r = scl._targets_row_to_params(row)

    assert r.column == column
    assert r.target == target
    assert r.metric == metric
    assert r.filters == ['geo_id == "a"', 'filter_col < 106']
    assert r.clip_low == clip_low
    assert r.clip_high == clip_high
    assert r.int_result == int_result