code: def test_converter_monkeypatched_postinit():
      called1 = False
  
      class Foo(eqx.Module):
          field: jax.Array = eqx.field(converter=jnp.asarray)
  
          def __post_init__(self):
              nonlocal called1
              assert not called1
              called1 = True
              assert tree_allclose(self.field, jnp.array(1.0))
  
      assert tree_allclose(
          Foo(1.0).field, jnp.array(1.0)
      )  # pyright: ignore
      assert called1
  
      called2 = False
      post_init = Foo.__post_init__
  
      def __post_init__(self):
          nonlocal called1
          nonlocal called2
          assert not called2
          called1 = False
          called2 = True
          post_init(self)
  
      Foo.__post_init__ = __post_init__  # pyright: ignore
      assert tree_allclose(
          Foo(1.0).field, jnp.array(1.0)
      )  # pyright: ignore
      assert called2
      assert called1
  
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 12 for calling a global function with example usage: test_converter_monkeypatched_postinit() without return types