code: def test_custom_field():
      def my_field(*, foo: Optional[bool] = None, **kwargs: Any):
          metadata = kwargs.pop("metadata", {})
          if foo is not None:
              metadata["foo"] = foo
          return eqx.field(metadata=metadata, **kwargs)
  
      class ExampleModel(eqx.Module):
          dynamic: jax.Array = my_field(foo=True)
          static: int = my_field(foo=False, static=True)
  
      model = ExampleModel(dynamic=jnp.array(1), static=1)
      dynamic_field, static_field = dataclasses.fields(model)
      assert dynamic_field.metadata == dict(foo=True)
      assert static_field.metadata == dict(foo=False, static=True)
  
imports: import abc
  import dataclasses
  import functools
  import inspect
  from collections.abc import Callable
  from dataclasses import InitVar
  from typing import Any, Optional
  import equinox
  import equinox.internal
  import jax
  import jax.numpy
  import jax.tree_util
  import pytest
  from .helpers import tree_allclose
label_desc: Use image node_id 41 for calling a global function with example usage: test_custom_field() and returns: eqx