Repository: quantopian/zipline
File: tests/pipeline/test_engine.py (Python)

Code before:
                precomputed_term_with_window_value,
            ),
        ),
        assert_equal(
            results['depends_on_precomputed_term'].values,
            full_like(
                results['depends_on_precomputed_term'],
                precomputed_term_value + 1,
            ),
        )
        assert_equal(
            results['depends_on_precomputed_term_with_window'].values,
            full_like(
                results['depends_on_precomputed_term_with_window'],
                precomputed_term_with_window_value + 1,
            ),
        )
        assert_equal(
            results['depends_on_window_of_precomputed_term'].values,
            full_like(
                results['depends_on_window_of_precomputed_term'],
                precomputed_term_value,
            ),
        )


class ChunkedPipelineTestCase(zf.WithSeededRandomPipelineEngine,
                              zf.ZiplineTestCase):

    PIPELINE_START_DATE = Timestamp('2006-01-05', tz='UTC')
    END_DATE = Timestamp('2006-12-29', tz='UTC')
    ASSET_FINDER_COUNTRY_CODE = 'US'

    def test_run_chunked_pipeline(self):
        """
        Test that running a pipeline in chunks produces the same result as if
        it were run all at once
        """

        pipe = Pipeline(
            columns={
                'float': TestingDataSet.float_col.latest,
                'custom_factor': SimpleMovingAverage(
                    inputs=[TestingDataSet.float_col],
                    window_length=10,
                ),
                'categorical': TestingDataSet.categorical_col.latest,
            },
            domain=US_EQUITIES,
        )
        pipeline_result = self.run_pipeline(

Review comment (suggestion):
This test didn't actually care about using `EquityPricing` specifically; it just used the default values from the fixture and asserted that we got the same results running with or without chunks.

I switched to using `WithSeededRandomPipelineEngine` both to make that more clear, and to be get access to a string-dtype column.

Code after:
            ),
        ),
        assert_equal(
            results['depends_on_precomputed_term'].values,
            full_like(
                results['depends_on_precomputed_term'],
                precomputed_term_value + 1,
            ),
        )
        assert_equal(
            results['depends_on_precomputed_term_with_window'].values,
            full_like(
                results['depends_on_precomputed_term_with_window'],
                precomputed_term_with_window_value + 1,
            ),
        )
        assert_equal(
            results['depends_on_window_of_precomputed_term'].values,
            full_like(
                results['depends_on_window_of_precomputed_term'],
                precomputed_term_value,
            ),
        )


class ChunkedPipelineTestCase(zf.WithSeededRandomPipelineEngine,
                              zf.ZiplineTestCase):

    PIPELINE_START_DATE = Timestamp('2006-01-05', tz='UTC')
    END_DATE = Timestamp('2006-12-29', tz='UTC')
    ASSET_FINDER_COUNTRY_CODE = 'US'

    def test_run_chunked_pipeline(self):
        """
        Test that running a pipeline in chunks produces the same result as if
        it were run all at once
        """

        pipe = Pipeline(
            columns={
                'float': TestingDataSet.float_col.latest,
                'custom_factor': SimpleMovingAverage(
                    inputs=[TestingDataSet.float_col],
                    window_length=10,
                ),
            },
            domain=US_EQUITIES,
        )

        if not new_pandas:
            # Categoricals only work on old pandas.