def test_strict_loading(strict_loading, expected, tmp_path):
    """Test that the connector respects the `LightningModule.strict_loading` setting."""
    model = BoringModel()
    trainer = Trainer(default_root_dir=tmp_path, barebones=True, max_steps=1)
    trainer.fit(model)
    trainer.save_checkpoint(tmp_path / "checkpoint.ckpt")

    model = BoringModel()
    model.strict_loading = strict_loading
    model.load_state_dict = Mock()

    trainer = Trainer(default_root_dir=tmp_path, barebones=True, max_steps=2)
    trainer.fit(model, ckpt_path=(tmp_path / "checkpoint.ckpt"))
    model.load_state_dict.assert_called_once_with(ANY, strict=expected)
Test that the connector respects the `LightningModule.strict_loading` setting.
tests/tests_pytorch/trainer/connectors/test_checkpoint_connector.py