def test_model_checkpoint_file_extension(tmp_path):
    """Test ModelCheckpoint with different file extension."""
    model = LogInTwoMethods()
    model_checkpoint = ModelCheckpointExtensionTest(
        monitor="early_stop_on", dirpath=tmp_path, save_top_k=1, save_last=True
    )
    trainer = Trainer(default_root_dir=tmp_path, callbacks=[model_checkpoint], max_steps=1, logger=False)
    trainer.fit(model)

    expected = ["epoch=0-step=1.tpkc", "last.tpkc"]
    assert set(expected) == set(os.listdir(tmp_path))
Test ModelCheckpoint with different file extension.
tests/tests_pytorch/checkpointing/test_model_checkpoint.py