dag = DAG("test-dag", render_template_as_native_obj=use_native_obj)
        jinja_env = dag.get_template_env(force_sandboxed=force_sandboxed)
        assert isinstance(jinja_env, expected_env)
    def test_resolve_template_files_value(self):
        with NamedTemporaryFile(suffix=".template") as f:
            f.write(b"{{ ds }}")
            f.flush()
            template_dir = os.path.dirname(f.name)
            template_file = os.path.basename(f.name)
            with DAG("test-dag", start_date=DEFAULT_DATE, template_searchpath=template_dir):
                task = EmptyOperator(task_id="op1")
            task.test_field = template_file
            task.template_fields = ("test_field",)
            task.template_ext = (".template",)
            task.resolve_template_files()
        assert task.test_field == "{{ ds }}"
    def test_resolve_template_files_list(self):
        with NamedTemporaryFile(suffix=".template") as f:
            f.write(b"{{ ds }}")
            f.flush()
            template_dir = os.path.dirname(f.name)
            template_file = os.path.basename(f.name)
            with DAG("test-dag", start_date=DEFAULT_DATE, template_searchpath=template_dir):
                task = EmptyOperator(task_id="op1")
            task.test_field = [template_file, "some_string"]
            task.template_fields = ("test_field",)
            task.template_ext = (".template",)
            task.resolve_template_files()
        assert task.test_field == ["{{ ds }}", "some_string"]
    def test_following_previous_schedule(self):