docstr: Test that slices correctly inherit the `window_safe` property of the
  term from which they are derived.
docstr_tok: ["Test","that","slices","correctly","inherit","the","`","window_safe","`","property","of","the","term","from","which","they","are","derived","."]
code: def _test_window_safety_of_slices(self):
      """
      Test that slices correctly inherit the `window_safe` property of the
      term from which they are derived.
      """
      col = self.col
      my_asset = self.asset_finder.retrieve_asset(self.sids[0])
  
      # SimpleMovingAverage is not window safe.
      sma = SimpleMovingAverage(inputs=[self.col], window_length=10)
      sma_slice = sma[my_asset]
  
      class UsesSlicedInput(CustomFactor):
          window_length = 1
          inputs = [sma_slice]
  
          def compute(self, today, assets, out, sma_slice):
              pass
  
      with self.assertRaises(NonWindowSafeInput):
          self.run_pipeline(
              Pipeline(
                  columns={"uses_sliced_input": UsesSlicedInput()}
              ),
              self.pipeline_start_date,
              self.pipeline_end_date,
          )
  
      # Make sure that slices of custom factors are not window safe.
      class MyUnsafeFactor(CustomFactor):
          window_length = 1
          inputs = [col]
  
          def compute(self, today, assets, out, col):
              pass
  
      my_unsafe_factor = MyUnsafeFactor()
      my_unsafe_factor_slice = my_unsafe_factor[my_asset]
  
      class UsesSlicedInput(CustomFactor):
          window_length = 1
          inputs = [my_unsafe_factor_slice]
  
          def compute(self, today, assets, out, my_unsafe_factor_slice):
              pass
  
      with self.assertRaises(NonWindowSafeInput):
          self.run_pipeline(
              Pipeline(
                  columns={"uses_sliced_input": UsesSlicedInput()}
              ),
              self.pipeline_start_date,
              self.pipeline_end_date,
          )
  
      # Create a window safe factor.
      class MySafeFactor(CustomFactor):
          window_length = 1
          inputs = [col]
          window_safe = True
  
          def compute(self, today, assets, out, col):
              pass
  
      my_safe_factor = MySafeFactor()
      my_safe_factor_slice = my_safe_factor[my_asset]
  
      # Make sure that correlations are not safe if either the factor *or*
      # the target slice are not window safe.
      with self.assertRaises(NonWindowSafeInput):
          my_unsafe_factor.pearsonr(
              target=my_safe_factor_slice,
              correlation_length=10,
          )
  
      with self.assertRaises(NonWindowSafeInput):
          my_safe_factor.pearsonr(
              target=my_unsafe_factor_slice,
              correlation_length=10,
          )
  
imports: from numpy import where
  from pandas import Int64Index, Timestamp
  from pandas.util.testing import assert_frame_equal
  from catalyst.assets import Asset
  from catalyst.errors import NonExistentAssetInTimeFrame, NonSliceableTerm, NonWindowSafeInput, UnsupportedPipelineOutput
  from catalyst.pipeline import CustomFactor, Pipeline
  from catalyst.pipeline.data import USEquityPricing
  from catalyst.pipeline.data.testing import TestingDataSet
  from catalyst.pipeline.factors.equity import Returns, RollingLinearRegressionOfReturns, RollingPearsonOfReturns, RollingSpearmanOfReturns, SimpleMovingAverage
  from catalyst.testing import AssetID, AssetIDPlusDay, check_arrays, OpenPrice, parameter_space
  from catalyst.testing.fixtures import WithSeededRandomPipelineEngine, CatalystTestCase
  from catalyst.utils.numpy_utils import datetime64ns_dtype
label_desc: Use image node_id 7 for calling the SliceTestCase obj's underlying member method code with example usage: obj._test_window_safety_of_slices() without return types