code: def test_set_and_build(self):
      # test regular dict and FrozenDict
      dict_obj = {"a": 1, "b": (2, 3), "c": [4, 5]}
      for d, freeze_wrap in (
          (dict_obj, lambda x: x),
          (freeze(dict_obj), freeze),
      ):
          # set API
          self.assertEqual(
              cursor(d)["b"][0].set(10),
              freeze_wrap({"a": 1, "b": (10, 3), "c": [4, 5]}),
          )
          # build API
          c = cursor(d)
          c["b"][0] = 20
          c["a"] = (100, 200)
          d2 = c.build()
          self.assertEqual(
              d2,
              freeze_wrap({"a": (100, 200), "b": (20, 3), "c": [4, 5]}),
          )
      self.assertEqual(
          dict_obj, {"a": 1, "b": (2, 3), "c": [4, 5]}
      )  # make sure original object is unchanged
  
      # test list and tuple
      list_obj = [0, dict_obj, (1, 2), [3, 4, 5]]
      for l, tuple_wrap in (
          (list_obj, lambda x: x),
          (tuple(list_obj), tuple),
      ):
          # set API
          self.assertEqual(
              cursor(l)[1]["b"][0].set(10),
              tuple_wrap(
                  [
                      0,
                      {"a": 1, "b": (10, 3), "c": [4, 5]},
                      (1, 2),
                      [3, 4, 5],
                  ]
              ),
          )
          # build API
          c = cursor(l)
          c[1]["b"][0] = 20
          c[2] = (100, 200)
          l2 = c.build()
          self.assertEqual(
              l2,
              tuple_wrap(
                  [
                      0,
                      {"a": 1, "b": (20, 3), "c": [4, 5]},
                      (100, 200),
                      [3, 4, 5],
                  ]
              ),
          )
      self.assertEqual(
          list_obj,
          [0, {"a": 1, "b": (2, 3), "c": [4, 5]}, (1, 2), [3, 4, 5]],
      )  # make sure original object is unchanged
  
      # test TrainState
      state = train_state.TrainState.create(
          apply_fn=lambda x: x,
          params=dict_obj,
          tx=optax.adam(1e-3),
      )
      # set API
      self.assertEqual(
          cursor(state).params["b"][0].set(10).params,
          {"a": 1, "b": (10, 3), "c": [4, 5]},
      )
      # build API
      new_fn = lambda x: x + 1
      c = cursor(state)
      c.apply_fn = new_fn
      c.params["b"][0] = 20
      c.params["a"] = (100, 200)
      state2 = c.build()
      self.assertEqual(state2.apply_fn, new_fn)
      self.assertEqual(
          state2.params, {"a": (100, 200), "b": (20, 3), "c": [4, 5]}
      )
  
      self.assertEqual(
          dict_obj, {"a": 1, "b": (2, 3), "c": [4, 5]}
      )  # make sure original object is unchanged
  
      # test NamedTuple
      # set API
      t = GenericTuple(GenericTuple(0))
      self.assertEqual(
          cursor(t).x.x.set(1), GenericTuple(GenericTuple(1))
      )
  
      # build API
      c = cursor(t)
      c.x.x = 2
      c.x.y = 3
      c.y = 4
      t2 = c.build()
      self.assertEqual(t2, GenericTuple(GenericTuple(2, 3), 4))
  
      self.assertEqual(t, GenericTuple(GenericTuple(0)))
  
imports: import dataclasses
  from typing import Any, NamedTuple
  import jax
  import jax.numpy
  import optax
  from absl.testing import absltest
  import flax
  import flax.linen
  from flax.core import freeze
  from flax.cursor import AccessType, _traverse_tree, cursor
  from flax.errors import CursorFindError, TraverseTreeError
  from flax.training import train_state
label_desc: Use image node_id 5 for calling the CursorTest obj's underlying member method code with example usage: obj.test_set_and_build() without return types