# 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
import pytest
    from numcodecs.vlen import VLenBytes
from numcodecs.tests.common import (check_config, check_repr, check_encode_decode_array,
                                    check_backwards_compatibility, greetings,
                                    assert_array_items_equal)
    check_backwards_compatibility(VLenBytes.codec_id, arrays, [VLenBytes()])


def test_encode_errors():
    codec = VLenBytes()
    with pytest.raises(TypeError):
        codec.encode(1234)
    with pytest.raises(TypeError):
        codec.encode([1234, 5678])
    with pytest.raises(TypeError):
        codec.encode(np.ones(10, dtype='i4'))


def test_decode_errors():
    codec = VLenBytes()
    with pytest.raises(TypeError):
        codec.decode(1234)
    # these should look like corrupt data
    with pytest.raises(ValueError):
        codec.decode(b'foo')
    with pytest.raises(ValueError):
        codec.decode(np.arange(2, 3, dtype='i4'))
    with pytest.raises(ValueError):
        codec.decode(np.arange(10, 20, dtype='i4'))
    with pytest.raises(TypeError):
        codec.decode('foo')

    # test out parameter
    enc = codec.encode(arrays[0])
    with pytest.raises(TypeError):

# 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_vlen_bytes.py
import unittest
import numpy as np
import pytest
    from numcodecs.vlen import VLenBytes
from numcodecs.tests.common import (check_config, check_repr, check_encode_decode_array,
                                    check_backwards_compatibility, greetings,
                                    assert_array_items_equal)

    check_backwards_compatibility(VLenBytes.codec_id, arrays, [VLenBytes()])


def test_encode_errors():
    codec = VLenBytes()
    with pytest.raises(TypeError):
        codec.encode(1234)
    with pytest.raises(TypeError):
        codec.encode([1234, 5678])
    with pytest.raises(TypeError):
        codec.encode(np.ones(10, dtype='i4'))


def test_decode_errors():
    codec = VLenBytes()
    with pytest.raises(TypeError):
        codec.decode(1234)
    # these should look like corrupt data
    with pytest.raises(ValueError):
        codec.decode(b'foo')
    with pytest.raises(ValueError):
        codec.decode(np.arange(2, 3, dtype='i4'))
    with pytest.raises(ValueError):
        codec.decode(np.arange(10, 20, dtype='i4'))
    with pytest.raises(TypeError):
        codec.decode('foo')

    # test out parameter
    enc = codec.encode(arrays[0])
    with pytest.raises(TypeError):

        codec.decode(enc, out=b'foo')