Beispiel #1
0
def test_flatten_multiple_3_level_dict():
    d = {"a": {
            "b": {
                "c": {
                    "d": "e"
                },
                "c2": {
                    "d2": "e2"
                }
            }
        }
    }
    assert flatten_dict(d) == [["a", "b", "c", "d", "e"], ["a", "b", "c2", "d2", "e2"]] 
Beispiel #2
0
def test_flatten_empty_dict(dictionary):
    d = dictionary()
    assert flatten_dict(d) == []
Beispiel #3
0
def test_flatten_simple_2_level_dict():
    d = {"a": {"b": "c"}}
    assert flatten_dict(d) == [["a", "b", "c"]] 
Beispiel #4
0
def test_flatten_multiple_2_level_dict():
    d = {"a": {"b": "c", "d": "e"}}
    assert flatten_dict(d) == [["a", "b", "c"], ["a", "d", "e"]] 
Beispiel #5
0
def test_flatten_simple_dict():
    d = {"a": "b"}
    assert flatten_dict(d) == [["a", "b"]]

    d = {"a": "b", "c": "d"}
    assert flatten_dict(d) == [["a", "b"], ["c", "d"]]