def METHOD_NAME(tmp_path):
    tmpfile = os.path.join(str(tmp_path), "compressed.asdf")
    zlib_data = np.array(list(range(1000)))
    bzp2_data = np.array(list(range(1000)))
    tree = {"zlib_data": zlib_data, "bzp2_data": bzp2_data}
    with asdf.AsdfFile(tree) as af_out:
        af_out.set_array_compression(zlib_data, "zlib", level=1)
        af_out.set_array_compression(bzp2_data, "bzp2", compresslevel=9000)
        with pytest.raises(ValueError, match=r"compresslevel must be between 1 and 9"):
            af_out.write_to(tmpfile)
        af_out.set_array_compression(bzp2_data, "bzp2", compresslevel=9)
        af_out.write_to(tmpfile)
        assert af_out.get_array_compression_kwargs(bzp2_data)["compresslevel"] == 9
    with asdf.open(tmpfile) as af_in:
        assert af_in.get_array_compression(af_in.tree["zlib_data"]) == "zlib"
        assert af_in.get_array_compression(af_in.tree["bzp2_data"]) == "bzp2"