Exemplo 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
Exemplo n.º 2
0
def test_make_ordinal():
    o = ordinal('education', ['high school', 'college', 'Master\'s', 'PhD'])
    assert o.name == 'education'
    assert o.categories == OrderedDict([
        ('high school', 1),
        ('college', 2),
        ('Master\'s', 3),
        ('PhD', 4)
    ])
    assert o.drange == [1,4]
Exemplo 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()