def test_done_dataloader_iter_empty_iterables(mode):
    """Test that the `done` property for `dataloader_iter` gets set as expected for empty iterables."""
    fetcher = _DataLoaderIterDataFetcher()

    # single empty iterable
    loader = CombinedLoader([], mode=mode)
    fetcher.setup(loader)
    iter(fetcher)
    assert fetcher.done
    # multiple iterables and all are empty
    loader = CombinedLoader([[], []], mode=mode)
    fetcher.setup(loader)
    iter(fetcher)
    assert fetcher.done
    # one empty, one non-empty
    loader = CombinedLoader([[], [1, 2, 3]], mode=mode)
    fetcher.setup(loader)
    iter(fetcher)
    assert fetcher.done == (mode == "min_size")
Test that the `done` property for `dataloader_iter` gets set as expected for empty iterables.
tests/tests_pytorch/loops/test_fetchers.py