# Path: ckan_api_client/utils.py
# def freeze(obj):
#     """
#     Returns the "frozen" version of a mutable type.
# 
#     :raises TypeError:
#         if a frozen version for that object doesn't exist
#     """
#     if obj is None:
#         return None
#     if isinstance(obj, (basestring, int, float, bool)):
#         return obj
#     if isinstance(obj, dict):
#         return FrozenDict(obj)
#     if isinstance(obj, list):
#         return FrozenList(obj)
#     if isinstance(obj, tuple):
#         return FrozenTuple(obj)
#     raise TypeError("I don't know how to freeze this!")
# 
# class FrozenDict(MutableMapping):
#     """
#     Frozen dictionary.
#     Acts as a read-only dictionary, preventing changes
#     and returning frozen objects when asked for values.
#     """
# 
#     def __init__(self, *a, **kw):
#         self.__wrapped = dict(*a, **kw)
# 
#     def __getitem__(self, name):
#         return freeze(self.__wrapped[name])
# 
#     def __setitem__(self, name, value):
#         raise TypeError("FrozenDict doesn't support item assignment")
# 
#     def __delitem__(self, name):
#         raise TypeError("FrozenDict doesn't support item deletion")
# 
#     def __iter__(self):
#         return iter(self.__wrapped)
# 
#     def __len__(self):
#         return len(self.__wrapped)
# 
# class FrozenList(FrozenSequence):
#     """Immutable list-like."""
#     pass


import pytest
from ckan_api_client.utils import freeze, FrozenDict, FrozenList
    my_dict = {
        'key': 'DEFAULT',
    }

    my_frozen_dict = freeze(my_dict)
    assert my_dict == my_frozen_dict
    assert isinstance(my_frozen_dict, FrozenDict)

    # ----------------------------------------
    # We can mutate my_dict

    my_dict['key'] = 'UPDATED-1'
    assert my_dict['key'] == 'UPDATED-1'
    assert my_frozen_dict['key'] == 'DEFAULT'

    del my_dict['key']
    assert 'key' not in my_dict
    assert 'key' in my_frozen_dict
    assert my_frozen_dict['key'] == 'DEFAULT'

    my_dict['key'] = 'UPDATED-2'
    assert my_dict['key'] == 'UPDATED-2'
    assert my_frozen_dict['key'] == 'DEFAULT'

    # ----------------------------------------
    # We cannot mutate my_frozen_dict

    with pytest.raises(TypeError):
        my_frozen_dict['key'] = 'WROLD!!'


# Path: ckan_api_client/utils.py
# def freeze(obj):
#     """
#     Returns the "frozen" version of a mutable type.
# 
#     :raises TypeError:
#         if a frozen version for that object doesn't exist
#     """
#     if obj is None:
#         return None
#     if isinstance(obj, (basestring, int, float, bool)):
#         return obj
#     if isinstance(obj, dict):
#         return FrozenDict(obj)
#     if isinstance(obj, list):
#         return FrozenList(obj)
#     if isinstance(obj, tuple):
#         return FrozenTuple(obj)
#     raise TypeError("I don't know how to freeze this!")
# 
# class FrozenDict(MutableMapping):
#     """
#     Frozen dictionary.
#     Acts as a read-only dictionary, preventing changes
#     and returning frozen objects when asked for values.
#     """
# 
#     def __init__(self, *a, **kw):
#         self.__wrapped = dict(*a, **kw)
# 
#     def __getitem__(self, name):
#         return freeze(self.__wrapped[name])
# 
#     def __setitem__(self, name, value):
#         raise TypeError("FrozenDict doesn't support item assignment")
# 
#     def __delitem__(self, name):
#         raise TypeError("FrozenDict doesn't support item deletion")
# 
#     def __iter__(self):
#         return iter(self.__wrapped)
# 
#     def __len__(self):
#         return len(self.__wrapped)
# 
# class FrozenList(FrozenSequence):
#     """Immutable list-like."""
#     pass


# Path: ckan_api_client/tests/unit/test_frozen_objects.py
import pytest
from ckan_api_client.utils import freeze, FrozenDict, FrozenList

    my_dict = {
        'key': 'DEFAULT',
    }

    my_frozen_dict = freeze(my_dict)
    assert my_dict == my_frozen_dict
    assert isinstance(my_frozen_dict, FrozenDict)

    # ----------------------------------------
    # We can mutate my_dict

    my_dict['key'] = 'UPDATED-1'
    assert my_dict['key'] == 'UPDATED-1'
    assert my_frozen_dict['key'] == 'DEFAULT'

    del my_dict['key']
    assert 'key' not in my_dict
    assert 'key' in my_frozen_dict
    assert my_frozen_dict['key'] == 'DEFAULT'

    my_dict['key'] = 'UPDATED-2'
    assert my_dict['key'] == 'UPDATED-2'
    assert my_frozen_dict['key'] == 'DEFAULT'

    # ----------------------------------------
    # We cannot mutate my_frozen_dict

    with pytest.raises(TypeError):
        my_frozen_dict['key'] = 'WROLD!!'


    with pytest.raises(TypeError):