def test_read_filtered_data(compression, shuffle, fletcher32,
                            gzip_level):
    # Make the filters dict.
    filts = {'compression': compression,
             'shuffle': shuffle,
             'fletcher32': fletcher32}
    if compression == 'gzip':
        filts['compression_opts'] = gzip_level

    # Make some random data.
    dims = random.randint(1, 4)
    data = random_numpy(shape=random_numpy_shape(dims,
                        max_array_axis_length),
                        dtype=random.choice(tuple(
                        set(dtypes) - set(['U']))))
    # Make a random name.
    name = random_name()

    # Write the data to the file with the given name with the provided
    # filters and read it back.
    with tempfile.TemporaryDirectory() as folder:
        filename = os.path.join(folder, 'data.h5')
        with h5py.File(filename, mode='w') as f:
            f.create_dataset(name, data=data, chunks=True, **filts)
        out = hdf5storage.read(path=name, filename=filename,
                               matlab_compatible=False)

    # Compare
    assert_equal(out, data)