code: def test_leaf_serialisation_file(getkey, tmp_path):
      tree, like, like_func, like_obj = _example_trees()
  
      with open(os.path.join(tmp_path, "test.eqx"), "wb") as tmp_file:
          eqx.tree_serialise_leaves(tmp_file, tree)
  
      with open(os.path.join(tmp_path, "test.eqx"), "rb") as tmp_file:
          tree_loaded = eqx.tree_deserialise_leaves(tmp_file, like)
  
      tree_serialisable = tree[:-2]
      tree_loaded_serialisable = tree_loaded[:-2]
      tree_loaded_func, tree_loaded_obj = tree_loaded[-2:]
  
      assert eqx.tree_equal(tree_serialisable, tree_loaded_serialisable)
      assert tree_loaded_func is like_func
      assert tree_loaded_obj is like_obj
  
file_path: equinox/tests/test_serialisation.py
imports: import os
  import equinox
  import jax
  import jax.numpy
  import numpy
  import pytest
  from jax.dtypes import bfloat16
label_desc: Use image node_id 3 for calling a global function with example usage: test_leaf_serialisation_file(getkey, tmp_path) without return types