def test_train_dataloader_passed_to_fit(tmp_path):
    """Verify that train dataloader can be passed to fit."""
    # only train passed to fit
    model = BoringModel()
    train_loader = model.train_dataloader()
    trainer = Trainer(default_root_dir=tmp_path, fast_dev_run=2)
    fit_options = {"train_dataloaders": train_loader}
    trainer.fit(model, **fit_options)
    assert trainer.num_training_batches == 2
    assert trainer.train_dataloader == train_loader
Verify that train dataloader can be passed to fit.
tests/tests_pytorch/trainer/test_dataloaders.py