This method is used in DagFileProcessor.process_file - it may be easier to migrate all it's internal calls instead of the whole method.
"""
        Helper method to process a file generated from the input create_dag function.
        """
        
        source = textwrap.dedent("".join(inspect.getsource(create_dag).splitlines(True)[1:-1]))
        with NamedTemporaryFile() as f:
            f.write(source.encode("utf8"))
            f.flush()
            dagbag = models.DagBag(dag_folder=self.empty_dir, include_examples=False)
            found_dags = dagbag.process_file(f.name)
            return dagbag, found_dags, f.name
    def validate_dags(self, expected_parent_dag, actual_found_dags, actual_dagbag, should_be_found=True):
        expected_dag_ids = list(map(lambda dag: dag.dag_id, expected_parent_dag.subdags))
        expected_dag_ids.append(expected_parent_dag.dag_id)
        actual_found_dag_ids = list(map(lambda dag: dag.dag_id, actual_found_dags))
        for dag_id in expected_dag_ids:
            actual_dagbag.log.info("validating %s", dag_id)
            assert (dag_id in actual_found_dag_ids) == should_be_found, (
                f"dag \"{dag_id}\" should {'' if should_be_found else 'not '}"
                f'have been found after processing dag "{expected_parent_dag.dag_id}"'
            )
            assert (dag_id in actual_dagbag.dags) == should_be_found, (
                f"dag \"{dag_id}\" should {'' if should_be_found else 'not '}"
                f'be in dagbag.dags after processing dag "{expected_parent_dag.dag_id}"'
            )
    def test_load_subdags(self):