Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter committed Jul 8, 2024
1 parent 2bf3f77 commit c64d0af
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/unit/utils/test_dict_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from griptape.utils import remove_null_values_in_dict_recursively, dict_merge
from griptape.utils import remove_null_values_in_dict_recursively, dict_merge, remove_key_in_dict_recursively
import pytest


Expand All @@ -10,6 +10,13 @@ def test_remove_null_values_in_dict_recursively(self):

assert remove_null_values_in_dict_recursively(dict_with_nones) == dict_without_nones

def test_remove_key_in_dict_recursively(self):
dict_with_key = {"foo": 1, "bar": {"baz": {"quxx": [1, 2, 3], "bar": 2}}}

dict_without_key = {"foo": 1, "bar": {"baz": {"bar": 2}}}

assert remove_key_in_dict_recursively(dict_with_key, "quxx") == dict_without_key

def test_dict_merge_merges_dicts(self):
a = {"a": 1, "b": {"b1": 2, "b2": 3}}
b = {"a": 1, "b": {"b1": 4}}
Expand Down

0 comments on commit c64d0af

Please sign in to comment.