diff options
author | velom <velom@yandex-team.ru> | 2022-02-10 16:48:48 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:48 +0300 |
commit | 094e560ec880abc6d1e7e01b0c29666385268eb8 (patch) | |
tree | 3d0ef646b51d2a78ae93a5393f599c70275c67d1 /library/python/func | |
parent | 4e85f12f6d14e7af54905e3c6a2aed2410fe2553 (diff) | |
download | ydb-094e560ec880abc6d1e7e01b0c29666385268eb8.tar.gz |
Restoring authorship annotation for <velom@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/python/func')
-rw-r--r-- | library/python/func/__init__.py | 6 | ||||
-rw-r--r-- | library/python/func/ut/test_func.py | 16 |
2 files changed, 11 insertions, 11 deletions
diff --git a/library/python/func/__init__.py b/library/python/func/__init__.py index 7424361635..cf9476e476 100644 --- a/library/python/func/__init__.py +++ b/library/python/func/__init__.py @@ -156,9 +156,9 @@ def split(data, func): else: r.append(e) return l, r - - -def flatten_dict(dd, separator='.', prefix=''): + + +def flatten_dict(dd, separator='.', prefix=''): return ( { prefix + separator + k if prefix else k: v diff --git a/library/python/func/ut/test_func.py b/library/python/func/ut/test_func.py index 3c4fad1a07..e723d8081c 100644 --- a/library/python/func/ut/test_func.py +++ b/library/python/func/ut/test_func.py @@ -124,14 +124,14 @@ def test_split(): assert func.split([1, 0, 1], lambda x: x) == ([1, 1], [0]) -def test_flatten_dict(): - assert func.flatten_dict({"a": 1, "b": 2}) == {"a": 1, "b": 2} - assert func.flatten_dict({"a": 1}) == {"a": 1} - assert func.flatten_dict({}) == {} - assert func.flatten_dict({"a": 1, "b": {"c": {"d": 2}}}) == {"a": 1, "b.c.d": 2} - assert func.flatten_dict({"a": 1, "b": {"c": {"d": 2}}}, separator="/") == {"a": 1, "b/c/d": 2} - - +def test_flatten_dict(): + assert func.flatten_dict({"a": 1, "b": 2}) == {"a": 1, "b": 2} + assert func.flatten_dict({"a": 1}) == {"a": 1} + assert func.flatten_dict({}) == {} + assert func.flatten_dict({"a": 1, "b": {"c": {"d": 2}}}) == {"a": 1, "b.c.d": 2} + assert func.flatten_dict({"a": 1, "b": {"c": {"d": 2}}}, separator="/") == {"a": 1, "b/c/d": 2} + + def test_memoize_thread_local(): class Counter(object): def __init__(self, s): |