def test_shuffle_per_row_group(scalar_dataset):
    """Check if every row group is shuffled."""
    for reader_factory in [make_batch_reader, make_reader]:
        with reader_factory(scalar_dataset.url, reader_pool_type='dummy',
                            shuffle_rows=True, shuffle_row_groups=False) 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

        assert len(scalar_dataset.data) == len(actual_row_ids)
        # Row ids are shuffled in output
        assert not np.array_equal(list(np.arange(len(scalar_dataset.data))), actual_row_ids)
Check if every row group is shuffled.
petastorm/tests/test_parquet_reader.py