code: def test_causal_save_and_load(self, housing_data, tmpdir):
      train_df, test_df, target_feature = housing_data
  
      save_dir = tmpdir.mkdir("save-dir")
  
      insights = RAIInsights(
          None, train_df, test_df, target_feature, ModelTask.REGRESSION
      )
  
      insights.causal.add(["AveRooms"])
      insights.compute()
  
      pre_results = insights.causal.get()
      pre_result = pre_results[0]
  
      insights.causal._save(save_dir)
      manager = insights.causal._load(save_dir, insights)
      post_results = manager.get()
      post_result = post_results[0]
      assert post_result.id == pre_result.id
      assert post_result.causal_analysis is not None
      assert post_result.global_effects is not None
      assert post_result.local_effects is not None
      assert post_result.policies is not None
  
      # Remove the causal analysis models to test the loading of
      # causal models in case there is error in loading of the causal
      # models.
      all_causal_dirs = DirectoryManager.list_sub_directories(save_dir)
      for causal_dir in all_causal_dirs:
          dm = DirectoryManager(
              parent_directory_path=save_dir,
              sub_directory_name=causal_dir,
          )
          causal_analysis_pkl_file_path = dm.get_data_directory() / (
              "causal_analysis" + FileFormats.PKL
          )
          os.remove(causal_analysis_pkl_file_path)
  
      model_load_err = (
          "ERROR-LOADING-EXPLAINER: "
          "There was an error loading the explainer. "
          "Some of RAI dashboard features may not work."
      )
      with pytest.warns(UserWarning, match=model_load_err):
          manager = insights.causal._load(save_dir, insights)
      post_results = manager.get()
      post_result = post_results[0]
      assert post_result.id == pre_result.id
      assert post_result.causal_analysis is None
      assert post_result.global_effects is not None
      assert post_result.local_effects is not None
      assert post_result.policies is not None
  
imports: import os
  from unittest.mock import ANY, patch
  import numpy
  import pytest
  from raiutils.exceptions import UserConfigValidationException
  from raiutils.models import ModelTask
  from responsibleai import RAIInsights
  from responsibleai._interfaces import CausalData
  from responsibleai._internal.constants import FileFormats
  from responsibleai._tools.shared.state_directory_management import DirectoryManager
  from responsibleai.managers.causal_manager import CausalManager
label_desc: Use image node_id 2 for calling the TestCausalManager obj's underlying member method code with example usage: obj.test_causal_save_and_load(housing_data, tmpdir) without return types