def test_get_model(tmp_path):
    """Tests that `trainer.lightning_module` extracts the model correctly."""
    model = TrainerGetModel()

    limit_train_batches = 2
    trainer = Trainer(
        default_root_dir=tmp_path, limit_train_batches=limit_train_batches, limit_val_batches=2, max_epochs=1
    )
    trainer.fit(model)
Tests that `trainer.lightning_module` extracts the model correctly.
tests/tests_pytorch/trainer/properties/test_get_model.py