# Path: numcodecs/tests/common.py
# def compare_arrays(arr, res, precision=None):
# def check_encode_decode(arr, codec, precision=None):
# def check_encode_decode_partial(arr, codec, precision=None):
# def assert_array_items_equal(res, arr):
# def check_encode_decode_array(arr, codec):
# def check_config(codec):
# def check_repr(stmt):
# def check_backwards_compatibility(codec_id, arrays, codecs, precision=None, prefix=None):
# def check_err_decode_object_buffer(compressor):
# def check_err_encode_object_buffer(compressor):
# def check_max_buffer_size(codec):


import unittest
import numpy as np
    from numcodecs.msgpacks import MsgPack
from numcodecs.tests.common import (check_config, check_repr, check_encode_decode_array,
                                    check_backwards_compatibility, greetings)
        actual = codec.decode(codec.encode(input_data))
        expect = np.array(input_data)
        assert expect.shape == actual.shape
        assert np.array_equal(expect, actual)


def test_encode_decode_shape_dtype_preserved():
    codec = MsgPack()
    for arr in arrays:
        actual = codec.decode(codec.encode(arr))
        assert arr.shape == actual.shape
        assert arr.dtype == actual.dtype


def test_bytes():
    # test msgpack behaviour with bytes and str (unicode)
    bytes_arr = np.array([b'foo', b'bar', b'baz'], dtype=object)
    unicode_arr = np.array(['foo', 'bar', 'baz'], dtype=object)

    # raw=False (default)
    codec = MsgPack()
    # works for bytes array, round-trips bytes to bytes
    b = codec.decode(codec.encode(bytes_arr))
    assert np.array_equal(bytes_arr, b)
    assert isinstance(b[0], bytes)
    assert b[0] == b'foo'
    # works for unicode array, round-trips unicode to unicode
    b = codec.decode(codec.encode(unicode_arr))
    assert np.array_equal(unicode_arr, b)
    assert isinstance(b[0], str)

# Path: numcodecs/tests/common.py
# def compare_arrays(arr, res, precision=None):
# def check_encode_decode(arr, codec, precision=None):
# def check_encode_decode_partial(arr, codec, precision=None):
# def assert_array_items_equal(res, arr):
# def check_encode_decode_array(arr, codec):
# def check_config(codec):
# def check_repr(stmt):
# def check_backwards_compatibility(codec_id, arrays, codecs, precision=None, prefix=None):
# def check_err_decode_object_buffer(compressor):
# def check_err_encode_object_buffer(compressor):
# def check_max_buffer_size(codec):


# Path: numcodecs/tests/test_msgpacks.py
import unittest
import numpy as np
    from numcodecs.msgpacks import MsgPack
from numcodecs.tests.common import (check_config, check_repr, check_encode_decode_array,
                                    check_backwards_compatibility, greetings)

        actual = codec.decode(codec.encode(input_data))
        expect = np.array(input_data)
        assert expect.shape == actual.shape
        assert np.array_equal(expect, actual)


def test_encode_decode_shape_dtype_preserved():
    codec = MsgPack()
    for arr in arrays:
        actual = codec.decode(codec.encode(arr))
        assert arr.shape == actual.shape
        assert arr.dtype == actual.dtype


def test_bytes():
    # test msgpack behaviour with bytes and str (unicode)
    bytes_arr = np.array([b'foo', b'bar', b'baz'], dtype=object)
    unicode_arr = np.array(['foo', 'bar', 'baz'], dtype=object)

    # raw=False (default)
    codec = MsgPack()
    # works for bytes array, round-trips bytes to bytes
    b = codec.decode(codec.encode(bytes_arr))
    assert np.array_equal(bytes_arr, b)
    assert isinstance(b[0], bytes)
    assert b[0] == b'foo'
    # works for unicode array, round-trips unicode to unicode
    b = codec.decode(codec.encode(unicode_arr))
    assert np.array_equal(unicode_arr, b)
    assert isinstance(b[0], str)

    assert b[0] == 'foo'