code: def test_method_assignment2():
      # From https://github.com/patrick-kidger/equinox/issues/327
      class Component(eqx.Module):
          transform: Callable[[float], float]
          validator: Callable[[Callable], Callable]
  
          def __init__(
              self, transform=lambda x: x, validator=lambda f: f
          ) -> None:
              self.transform = transform
              self.validator = validator
  
          def __call__(self, x):
              return self.validator(self.transform)(x)
  
      class SubComponent(Component):
          test: Callable[[float], float]
  
          def __init__(self, test=lambda x: 2 * x) -> None:
              self.test = test
              super().__init__(self._transform)
  
          def _transform(self, x):
              return self.test(x)
  
      with pytest.raises(
          ValueError, match="Cannot assign methods in __init__"
      ):
          SubComponent()
  
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 7 for calling a global function with example usage: test_method_assignment2() and returns: self, self