def test_save_last_cli(val, expected):
    """Test that the CLI can parse the `save_last` argument correctly (composed type)."""
    annot = signature(ModelCheckpoint).parameters["save_last"].annotation
    parser = ArgumentParser()
    parser.add_argument("--a", type=annot)
    args = parser.parse_args(["--a", val])
    assert args.a == expected
Test that the CLI can parse the `save_last` argument correctly (composed type).
tests/tests_pytorch/checkpointing/test_model_checkpoint.py