def test_random_seed(scalar_dataset):
    """Result should be reproducible with the same random seed."""
    for reader_factory in [make_batch_reader, make_reader]:
        results = []
        for _ in range(2):
            # seed has effects on shuffle_rows, shuffle_row_groups and sharding.
            with reader_factory(scalar_dataset.url, reader_pool_type='dummy',
                                shuffle_rows=True, seed=123, shuffle_row_groups=True,
                                cur_shard=0, shard_count=2) as reader:
                row_ids_batched = [row.id for row in reader]
            if reader_factory == make_batch_reader:
                actual_row_ids = list(itertools.chain(*row_ids_batched))
            else:
                # No need to unbatch
                actual_row_ids = row_ids_batched

            results.append(actual_row_ids)
        # Shuffled results are expected to be same
        np.testing.assert_equal(results[0], results[1])
Result should be reproducible with the same random seed.
petastorm/tests/test_parquet_reader.py