code: def test_mutate_undefined_collection(self):
      def f(scope):
          scope.put_variable("state", "test", 123)
  
      msg = (
          r'Cannot update variable "test" in "/" because collection "state" is'
          r" immutable."
      )
      with self.assertRaisesRegex(errors.ModifyScopeVariableError, msg):
          init(f, mutable="params")(random.key(0))
  
imports: import jax
  import numpy
  from absl.testing import absltest
  from jax import numpy
  from jax import random
  from flax import errors
  from flax.configurations import temp_flip_flag
  from flax.core import Scope, apply, freeze, init, lazy_init, nn, scope
  from flax.core.scope import LazyRng
label_desc: Use image node_id 9 for calling the ScopeTest obj's underlying member method code with example usage: obj.test_mutate_undefined_collection() without return types