def test_filter_recursive_and_flat(self): fancy_dict = FancyDict(key=FancyDict(filter_key=1, another_key=0)) assert { "filter_key": 1 } == fancy_dict.filter(lambda k, v: k is "filter_key", recursive=True, flat=True)
def test_filter_by_value(self): fancy_dict = FancyDict(filter_key=1, another_key=0) assert {"filter_key": 1} == fancy_dict.filter(lambda k, v: v is 1)