'Test that masking a factor that uses slices as inputs does not mask the
slice data.'

@parameter_space(unmasked_column=[0, 1, 2], slice_column=[0, 1, 2])
def test_slice_with_masking(self, unmasked_column, slice_column):

    sids = self.sids
    asset_finder = self.asset_finder
    start_date = self.pipeline_start_date
    end_date = self.pipeline_end_date
    unmasked_asset = asset_finder.retrieve_asset(sids[unmasked_column])
    unmasked_asset_only = AssetID().eq(unmasked_asset.sid)
    slice_asset = asset_finder.retrieve_asset(sids[slice_column])
    returns = Returns(window_length=2, inputs=[self.col])
    returns_slice = returns[slice_asset]
    returns_results = self.run_pipeline(Pipeline(columns={'returns': returns}), start_date, end_date)
    returns_results = returns_results['returns'].unstack()
    class UsesSlicedInput(CustomFactor, ):
        window_length = 1
        inputs = [returns, returns_slice]
        def compute(self, today, assets, out, returns, returns_slice):
            assert (returns.shape == (1, 1))
            assert (returns_slice.shape == (1, 1))
            assert (returns[(0, 0)] == returns_results.loc[(today, unmasked_asset)])
            assert (returns_slice[(0, 0)] == returns_results.loc[(today, slice_asset)])
    columns = {'masked': UsesSlicedInput(mask=unmasked_asset_only)}
    self.run_pipeline(Pipeline(columns=columns), start_date, end_date)
