code: def test_immutable_environment(self, env):
      env = ImmutableSandboxedEnvironment()
      pytest.raises(
          SecurityError, env.from_string("{{ [].append(23) }}").render
      )
      pytest.raises(
          SecurityError, env.from_string("{{ {1:2}.clear() }}").render
      )
  
imports: import pytest
  from jinja2 import Environment
  from jinja2 import escape
  from jinja2 import Markup
  from jinja2._compat import text_type
  from jinja2.exceptions import SecurityError
  from jinja2.exceptions import TemplateRuntimeError
  from jinja2.exceptions import TemplateSyntaxError
  from jinja2.nodes import EvalContext
  from jinja2.sandbox import ImmutableSandboxedEnvironment
  from jinja2.sandbox import SandboxedEnvironment
  from jinja2.sandbox import unsafe
label_desc: Use image node_id 2 for calling the TestSandbox obj's underlying member method code with example usage: obj.test_immutable_environment(env) without return types