code: def test_required_with_scope(self, env):
      env = Environment(
          loader=DictLoader(
              {
                  "default1": "{% for item in seq %}[{% block item scoped required %}"
                  "{% endblock %}]{% endfor %}",
                  "child1": "{% extends 'default1' %}{% block item %}"
                  "{{ item }}{% endblock %}",
                  "default2": "{% for item in seq %}[{% block item required scoped %}"
                  "{% endblock %}]{% endfor %}",
                  "child2": "{% extends 'default2' %}{% block item %}"
                  "{{ item }}{% endblock %}",
              }
          )
      )
      t1 = env.get_template("child1")
      t2 = env.get_template("child2")
  
      assert t1.render(seq=list(range(3))) == "[0][1][2]"
  
      # scoped must come before required
      with pytest.raises(TemplateSyntaxError):
          t2.render(seq=list(range(3)))
  
imports: import pytest
  from jinja2 import DictLoader
  from jinja2 import Environment
  from jinja2 import TemplateRuntimeError
  from jinja2 import TemplateSyntaxError
label_desc: Use image node_id 19 for calling the TestInheritance obj's underlying member method code with example usage: obj.test_required_with_scope(env) without return types