Created
November 21, 2021 04:33
-
-
Save guissalustiano/3a01d8140b57a9ec61f9ddcd2239f46d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from util import flatten_dict | |
def test_flatten_dict_nivel_1(): | |
assert flatten_dict({'a': 1, 'b': 2}) == {'a': 1, 'b': 2} | |
def test_flatten_dict_nivel_3(): | |
assert flatten_dict({'a': 1, 'b': {'c': 2, 'd': 3}}) == \ | |
{'a': 1, 'b.c': 2, 'b.d': 3} | |
def test_flatten_dict_nivel_4(): | |
assert flatten_dict({'a': {'b': {'c': {'d': 1}}}}) == {'a.b.c.d': 1} | |
def test_flatten_dict_nivel_separador(): | |
assert flatten_dict({'a': {'b': 1}}, '_') == {'a_b': 1} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment