Files
flowsint/flowsint-core/tests/utils/flatten.py
dextmorgn 3c39f9aeb7 feat(core): cleaner code separation + usage of nodeLabel
- big refactor to properly use GraphService, and enforce dependency injection

BREAKING CHANGE: The usage of node.label is no longer supported in the app, a specific node format
is used throughout the app and for inserting in the neo4j.
2026-01-21 17:17:13 +01:00

39 lines
893 B
Python

from flowsint_core.utils import flatten, unflatten
my_dict = {
"root_key_1": "value 1",
"root_key_2": 2,
"root_key_3": "value 3",
"root_key_4": {
"child_key_1": "child 1",
"child_key_2": "child 2",
"child_key_3": {"grand_child_1": 0},
},
}
my_flat_dict = {
"root_key_1": "value 1",
"root_key_2": 2,
"root_key_3": "value 3",
"root_key_4.child_key_1": "child 1",
"root_key_4.child_key_2": "child 2",
"root_key_4.child_key_3.grand_child_1": 0,
}
my_flat_dict_other_separator = {
"root_key_1": "value 1",
"root_key_2": 2,
"root_key_3": "value 3",
"root_key_4_child_key_1": "child 1",
"root_key_4_child_key_2": "child 2",
"root_key_4_child_key_3_grand_child_1": 0,
}
def test_flatten():
assert flatten(my_dict) == my_flat_dict
def test_unflatten():
assert unflatten(my_flat_dict) == my_dict