Exemplo n.º 1
0
def test_flatten_multiple():
    assert flatten_dict({
        'a': {
            'inner_a': 42,
            'inner_b': 350
        },
        'b': 3.14
    }) == [42, 350, 3.14]
Exemplo n.º 2
0
def test_flatten_dict_mixed_datatypes_2():
        assert flatten_dict(test_dict_6) == [
            ['Ralph', 'Betty', 'Joey'],
            {'dogs': {'terriers': ['Fido', 'Bonzo'],
                            'retrievers': ['Devil', 'Angel'] },
             'cat': 'Sox' },
            'Netherlands',
            '1.5 - 2.5'
             ]
Exemplo n.º 3
0
def test_flatten_dict2():
    assert flatten_dict({'a': [42, 350], 'b': 3.14}) == [[42, 350], 3.14]
Exemplo n.º 4
0
def test_flatten_dict_is_list():
    result = flatten_dict(test_no_list_2)
    assert type(result) == list
Exemplo n.º 5
0
def test_flatten_single():
    assert flatten_dict({'a': 42}) == [42]
Exemplo n.º 6
0
def test_flatten_dict():
    assert flatten_dict({'a': 42, 'b': 3.14}) == [42, 3.14]
Exemplo n.º 7
0
def test_flatten_dict_nested_3():
     assert flatten_dict(test_nested_dict_9) == [ [{'inner_inner_a': 14}, 'nested_2', 'nested_3'], 16]
Exemplo n.º 8
0
def test_flatten_dict_type():
    assert type(flatten_dict({'a': 42, 'b': 3.14})) == list
Exemplo n.º 9
0
def test_flatten_dict_nested_1():
    assert flatten_dict(test_nested_dict_7) == [{'inner_a': 42, 'inner_b': 350}, 3.14]
Exemplo n.º 10
0
def test_flatten_dict_nested_2():
    assert flatten_dict(test_nested_dict_8) == [ [{'inner_inner_a': 42}] ]
Exemplo n.º 11
0
def test_flatten_mixed_datatypes_3():
     assert flatten_dict(test_nested_dict_7) == [
         {'inner_a': 42, 'inner_b': 350},
         3.14
         ]
Exemplo n.º 12
0
def test_flatten_dict_simple_1():
    assert flatten_dict(test_dict_1) == [10, 9, 10]
Exemplo n.º 13
0
def test_flatten_dict_mixed_datatypes_1():
        assert flatten_dict(test_dict_5) == [
             ['Ralph', 'Betty', 'Joey'],
             {'dog': 'Fido', 'cat': 'Sox'}
             ]
Exemplo n.º 14
0
def test_flatten_dict_simple_4():
    assert flatten_dict(test_dict_4) == ['a','b','c','d']
Exemplo n.º 15
0
def test_flatten_dict_simple_3():
    assert flatten_dict(test_dict_3) == ['Fido','Sox']
Exemplo n.º 16
0
def test_flatten_dict_simple_2_2():
    assert flatten_dict(test_dict_2_2) == [ [42,350], 3.14]
Exemplo n.º 17
0
def test_flatten_dict_simple_2_1():
    assert flatten_dict(test_dict_2_1) == [42, 3.14]