def test_split(self, sample_collection, samples, batch_size):
        """test splitting sample collection into batches"""

        #####
        result = foms.SampleSliceBatch.split(
            sample_collection, workers := 8, batch_size=batch_size
        )
        #####

        expected_batch_size = (
            batch_size if batch_size is not None else len(samples) // workers
        )

        expected_batch_count = (
            len(samples) // batch_size if batch_size is not None else workers
        )

        start_and_stop_idxs = [
            (i * expected_batch_size, (i + 1) * expected_batch_size)
            for i in range(expected_batch_count)
        ]

        total = 0
        for idx, batch in enumerate(result):
            assert isinstance(batch, foms.SampleSliceBatch)
            assert batch.total == expected_batch_size
            total += batch.total

            start_idx, stop_idx = start_and_stop_idxs[idx]

            assert batch.start_idx == start_idx
            assert batch.stop_idx == stop_idx

        assert total == len(samples)
test splitting sample collection into batches
tests/unittests/map/test_slice_batch.py