def test_partition_multi_node(synthetic_dataset, reader_factory, seed):
    """Tests that the reader only returns half of the expected data consistently"""
    with reader_factory(synthetic_dataset.url, cur_shard=0, shard_count=5, seed=seed) as reader:
        with reader_factory(synthetic_dataset.url, cur_shard=0, shard_count=5, seed=seed) as reader_2:
            results_1 = set(_readout_all_ids(reader))
            results_2 = set(_readout_all_ids(reader_2))

            assert results_1, 'Non empty shard expected'

            np.testing.assert_equal(results_1, results_2)

            assert len(results_1) < len(synthetic_dataset.data)

            # Test that separate partitions also have no overlap by checking ids)
            for partition in range(1, 5):
                with reader_factory(synthetic_dataset.url, cur_shard=partition,
                                    shard_count=5, seed=seed) as reader_other:
                    ids_in_other_partition = set(_readout_all_ids(reader_other))

                    assert not ids_in_other_partition.intersection(results_1)
Tests that the reader only returns half of the expected data consistently
petastorm/tests/test_end_to_end.py