# Path: numcodecs/registry.py
# def get_codec(config):
#     """Obtain a codec for the given configuration.
# 
#     Parameters
#     ----------
#     config : dict-like
#         Configuration object.
# 
#     Returns
#     -------
#     codec : Codec
# 
#     Examples
#     --------
# 
#     >>> import numcodecs as codecs
#     >>> codec = codecs.get_codec(dict(id='zlib', level=1))
#     >>> codec
#     Zlib(level=1)
# 
#     """
#     config = dict(config)
#     codec_id = config.pop('id', None)
#     cls = codec_registry.get(codec_id)
#     if cls is None:
#         if codec_id in entries:
#             logger.debug("Auto loading codec '%s' from entrypoint", codec_id)
#             cls = entries[codec_id].load()
#             register_codec(cls, codec_id=codec_id)
#     if cls:
#         return cls.from_config(config)
#     raise ValueError('codec not available: %r' % codec_id)


import pytest
from numcodecs.registry import get_codec




def test_registry_errors():
    with pytest.raises(ValueError):
        get_codec({'id': 'foo'})


def test_get_codec_argument():
    # Check that get_codec doesn't modify its argument.
    arg = {"id": "json2"}
    before = dict(arg)

# Path: numcodecs/registry.py
# def get_codec(config):
#     """Obtain a codec for the given configuration.
# 
#     Parameters
#     ----------
#     config : dict-like
#         Configuration object.
# 
#     Returns
#     -------
#     codec : Codec
# 
#     Examples
#     --------
# 
#     >>> import numcodecs as codecs
#     >>> codec = codecs.get_codec(dict(id='zlib', level=1))
#     >>> codec
#     Zlib(level=1)
# 
#     """
#     config = dict(config)
#     codec_id = config.pop('id', None)
#     cls = codec_registry.get(codec_id)
#     if cls is None:
#         if codec_id in entries:
#             logger.debug("Auto loading codec '%s' from entrypoint", codec_id)
#             cls = entries[codec_id].load()
#             register_codec(cls, codec_id=codec_id)
#     if cls:
#         return cls.from_config(config)
#     raise ValueError('codec not available: %r' % codec_id)


# Path: numcodecs/tests/test_registry.py
import pytest
from numcodecs.registry import get_codec





def test_registry_errors():
    with pytest.raises(ValueError):
        get_codec({'id': 'foo'})


def test_get_codec_argument():
    # Check that get_codec doesn't modify its argument.
    arg = {"id": "json2"}
    before = dict(arg)

    get_codec(arg)