def test_fit_multiple_train_loaders(tmp_path, mode, num_training_batches):
    """Integration test for multiple train iterables."""

    class CustomBoringModel(BoringModel):
        def train_dataloader(self):
            loaders_a_b = [DataLoader(RandomDataset(32, 64)), DataLoader(RandomDataset(32, 16))]
            loaders_c_d_e = [
                DataLoader(RandomDataset(32, 16)),
                DataLoader(RandomDataset(32, 16)),
                DataLoader(RandomDataset(32, 16)),
            ]
            # Dict[str, List[DataLoader]]
            loaders = {"a_b": loaders_a_b, "c_d_e": loaders_c_d_e}
            return CombinedLoader(loaders, mode)

        def training_step(self, batch, batch_idx):
            assert len(batch) == 2
            assert len(batch["a_b"]) == 2
            assert len(batch["c_d_e"]) == 3
            return super().training_step(batch["a_b"][0], batch_idx)

    model = CustomBoringModel()
    trainer = Trainer(max_epochs=1, default_root_dir=tmp_path)

    if mode == "sequential":
        with pytest.raises(ValueError, match="FitLoop` does not support"):
            trainer.fit(model)
    else:
        trainer.fit(model)

    # verify the num_training_batches according to the mode
    assert num_training_batches == trainer.num_training_batches
Integration test for multiple train iterables.
tests/tests_pytorch/trainer/test_dataloaders.py