Exemplo n.º 1
0
def test_nested_group_by_none_exits(flat_data):
    nested_dict = nestify(flat_data, 'hello')
    assert nested_dict['root'] == flat_data
Exemplo n.º 2
0
def test_nested_group_by_none(flat_data):
    nested_dict = nestify(flat_data)
    assert nested_dict['root'] == flat_data
Exemplo n.º 3
0
def test_nested_group_by_city(flat_data):
    nested_dict = nestify(flat_data, 'city', 'currency', 'country')
    assert nested_dict['Madrid']['EUR']['ES'][0]['amount'] == 8.9
Exemplo n.º 4
0
def test_nested_group_by_one_key(flat_data):
    nested_dict = nestify(flat_data, 'city')
    assert nested_dict['Madrid'][0]['amount'] == 8.9
Exemplo n.º 5
0
def test_nested_group_original(flat_data, folded_data):
    nested_dict = nestify(flat_data, 'currency', 'country', 'city')
    assert nested_dict == folded_data
    assert 'USD' in nested_dict
    assert nested_dict['EUR']['ES']['Madrid'][0]['amount'] == 8.9