docstr: Test that `RollingPearsonOfReturns`, `RollingSpearmanOfReturns` and
  `RollingLinearRegressionOfReturns` raise the proper exception when
  given a nonexistent target asset.
docstr_tok: ["Test","that","`","RollingPearsonOfReturns","`",",","`","RollingSpearmanOfReturns","`","and","`","RollingLinearRegressionOfReturns","`","raise","the","proper","exception","when","given","a","nonexistent","target","asset","."]
code: def _test_correlation_and_regression_with_bad_asset(self):
      """
      Test that `RollingPearsonOfReturns`, `RollingSpearmanOfReturns` and
      `RollingLinearRegressionOfReturns` raise the proper exception when
      given a nonexistent target asset.
      """
      my_asset = Equity(0, exchange="TEST")
      start_date = self.pipeline_start_date
      end_date = self.pipeline_end_date
      run_pipeline = self.run_pipeline
  
      # This filter is arbitrary; the important thing is that we test each
      # factor both with and without a specified mask.
      my_asset_filter = AssetID().eq(1)
  
      for mask in (NotSpecified, my_asset_filter):
          pearson_factor = RollingPearsonOfReturns(
              target=my_asset,
              returns_length=3,
              correlation_length=3,
              mask=mask,
          )
          spearman_factor = RollingSpearmanOfReturns(
              target=my_asset,
              returns_length=3,
              correlation_length=3,
              mask=mask,
          )
          regression_factor = RollingLinearRegressionOfReturns(
              target=my_asset,
              returns_length=3,
              regression_length=3,
              mask=mask,
          )
  
          with self.assertRaises(NonExistentAssetInTimeFrame):
              run_pipeline(
                  Pipeline(columns={"pearson_factor": pearson_factor}),
                  start_date,
                  end_date,
              )
          with self.assertRaises(NonExistentAssetInTimeFrame):
              run_pipeline(
                  Pipeline(
                      columns={"spearman_factor": spearman_factor}
                  ),
                  start_date,
                  end_date,
              )
          with self.assertRaises(NonExistentAssetInTimeFrame):
              run_pipeline(
                  Pipeline(
                      columns={"regression_factor": regression_factor}
                  ),
                  start_date,
                  end_date,
              )
  
imports: from numpy import arange, full, full_like, nan, where
  from pandas import DataFrame, date_range, Int64Index, Timestamp
  from pandas.util.testing import assert_frame_equal
  from scipy.stats import linregress, pearsonr, spearmanr
  from catalyst.assets import Equity
  from catalyst.errors import IncompatibleTerms, NonExistentAssetInTimeFrame
  from catalyst.pipeline import CustomFactor, Pipeline
  from catalyst.pipeline.data import USEquityPricing
  from catalyst.pipeline.data.testing import TestingDataSet
  from catalyst.pipeline.engine import SimplePipelineEngine
  from catalyst.pipeline.factors.equity import Returns, RollingLinearRegressionOfReturns, RollingPearsonOfReturns, RollingSpearmanOfReturns
  from catalyst.pipeline.loaders.frame import DataFrameLoader
  from catalyst.pipeline.sentinels import NotSpecified
  from catalyst.testing import AssetID, AssetIDPlusDay, check_arrays, make_alternating_boolean_array, make_cascading_boolean_array, parameter_space
  from catalyst.testing.fixtures import WithSeededRandomPipelineEngine, WithTradingEnvironment, CatalystTestCase
  from catalyst.utils.numpy_utils import bool_dtype, datetime64ns_dtype, float64_dtype
label_desc: Use image node_id 4 for calling the StatisticalBuiltInsTestCase obj's underlying member method code with example usage: obj._test_correlation_and_regression_with_bad_asset() without return types