      backend_name = 'jinja2'
      options = {'keep_trailing_newline': True}
  
      def test_self_context(self):
          """
          Using 'self' in the context should not throw errors (#24538).
          """
          # self will be overridden to be a TemplateReference, so the self
 
</s> remove     tried = []
 </s> add     chain = [] </s> remove     tried = []
 </s> add     chain = [] </s> remove             postmortem = []

            # TODO: add support for multiple template engines (#24120).
            # TemplateDoesNotExist should carry all the information, including
            # the backend, rather than looping through engines.all.
            for engine in engines.all():
                if hasattr(engine, 'engine'):
                    e = engine.engine
                else:
                    e = engine

                postmortem.append(dict(
                    engine=engine,
                    tried=[
                        entry for entry in self.exc_value.tried if
                        entry[0].loader.engine == e
                    ],
                ))
            self.postmortem = postmortem
 </s> add             self.postmortem = self.exc_value.chain or [self.exc_value] </s> remove .. exception:: TemplateDoesNotExist
 </s> add .. exception:: TemplateDoesNotExist(msg, tried=None, backend=None, chain=None)
    def test_origin(self):
        template = self.engine.get_template('template_backends/hello.html')
        self.assertTrue(template.origin.name.endswith('hello.html'))
        self.assertEqual(template.origin.template_name, 'template_backends/hello.html')

    def test_origin_from_string(self):
        template = self.engine.from_string('Hello!\n')
        self.assertEqual(template.origin.name, '<template>')
        self.assertEqual(template.origin.template_name, None)

      backend_name = 'jinja2'
      options = {'keep_trailing_newline': True}
  
    def test_origin(self):
        template = self.engine.get_template('template_backends/hello.html')
        self.assertTrue(template.origin.name.endswith('hello.html'))
        self.assertEqual(template.origin.template_name, 'template_backends/hello.html')

    def test_origin_from_string(self):
        template = self.engine.from_string('Hello!\n')
        self.assertEqual(template.origin.name, '<template>')
        self.assertEqual(template.origin.template_name, None)

      def test_self_context(self):
          """
          Using 'self' in the context should not throw errors (#24538).
          """
          # self will be overridden to be a TemplateReference, so the self
keep keep add keep keep keep keep keep
 Fixed #24119, #24120 -- Formalized debug integration for template backends. 
tests/template_backends/test_jinja2.py