Ejemplo n.º 1
0
def test_load_data(): 
    variables = [ordinal('education', ['high school', 'college', 'PhD']), ratio('age', drange=[0,99])]
    file_path = './datasets/mini_test.csv'
    ds = load_data(file_path, variables, 'participant_id')

    assert ds.dfile == file_path
    assert ds.variables == variables
Ejemplo n.º 2
0
def test_make_ratio():
    r = ratio('age', drange=[0, 99])
    assert r.name == 'age'
    assert r.categories == None
    assert r.drange == [0, 99]
Ejemplo n.º 3
0
def test_load_data():
    variables = [
        ordinal('education', ['high school', 'college', 'PhD']),
        ratio('age', drange=[0, 99])
    ]
    file_path = './datasets/mini_test.csv'
    ds = load_data(file_path, variables, 'participant_id')

    assert ds.dfile == file_path
    assert ds.variables == variables


categories = ['high school', 'college', 'PhD']
# variables = [ordinal('education', categories)]
edu = ordinal('education', ['high school', 'college', 'PhD'])
age = ratio('age', drange=[0, 99])
variables = [edu, age]
file_path = './datasets/mini_test.csv'
ds = load_data(file_path, variables, 'participant_id')


def test_index_in_dataset():
    for v in variables:
        assert (ds[v.name].equals(ds.data[v.name]))


# def test_select_equals():
#     for v in variables:
#         all_unique = ds.data[v.name].unique()

#         for e in all_unique: