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_info=ExchangeInfo("TEST", "TEST FULL", "US"),
      )
      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: import numpy
  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 empyrical.stats import beta_aligned
  from zipline.assets import Equity, ExchangeInfo
  from zipline.errors import IncompatibleTerms, NonExistentAssetInTimeFrame
  from zipline.pipeline import CustomFactor, Pipeline
  from zipline.pipeline.data import USEquityPricing
  from zipline.pipeline.data.testing import TestingDataSet
  from zipline.pipeline.domain import US_EQUITIES
  from zipline.pipeline.engine import SimplePipelineEngine
  from zipline.pipeline.factors import Returns, RollingLinearRegressionOfReturns, RollingPearsonOfReturns, RollingSpearmanOfReturns, SimpleBeta
  from zipline.pipeline.factors.statistical import vectorized_beta, vectorized_pearson_r
  from zipline.pipeline.loaders.frame import DataFrameLoader
  from zipline.pipeline.sentinels import NotSpecified
  from zipline.testing import AssetID, AssetIDPlusDay, check_arrays, make_alternating_boolean_array, make_cascading_boolean_array, parameter_space
  import zipline.testing.fixtures
  from zipline.testing.predicates import assert_equal
  from zipline.utils.numpy_utils import as_column, bool_dtype, datetime64ns_dtype, float64_dtype
label_desc: Use image node_id 6 for calling the StatisticalBuiltInsTestCase obj's underlying member method code with example usage: obj.test_correlation_and_regression_with_bad_asset() without return types