def test_nested_dict_freeze(): nested_test = { 'first_key': 'string_value', 'dictionary_property': { 'some_key': 'some_value', 'another_key': [{ 'nested_key': 'nested_value' }] } } res = freeze(nested_test) assert isinstance(res, Map) assert isinstance(res['dictionary_property'], Map) assert isinstance(res['dictionary_property']['another_key'], tuple) assert isinstance(res['dictionary_property']['another_key'][0], Map)
def test_string_freeze(): '''leave the string as is''' string = 'just livin that string life' res = freeze(string) assert isinstance(res, str)
def test_basic_set_freeze(): '''convert to list''' basic_set = {1, 2, 3, 4} res = freeze(basic_set) assert isinstance(res, frozenset)
def test_basic_list_freeze(): '''convert to list''' basic_list = [1, 2, 3, 4] res = freeze(basic_list) assert isinstance(res, tuple)
def test_basic_tuple_freeze(): '''leave as tuple''' basic_tuple = (1, 2, 3, 4) res = freeze(basic_tuple) assert isinstance(res, tuple)
def test_basic_dict_freeze(): '''convert to frozen dict''' basic_dict = {'key': 'value'} res = freeze(basic_dict) assert isinstance(res, Map)