def test_args(tmp_path):
    """Test for inheritance: super class takes positional arg, subclass takes varargs."""
    hparams = {"test": 1}
    model = SubClassVarArgs(hparams)
    trainer = Trainer(default_root_dir=tmp_path, max_epochs=1)
    trainer.fit(model)

    raw_checkpoint_path = _raw_checkpoint_path(trainer)
    with pytest.raises(TypeError, match=r"__init__\(\) got an unexpected keyword argument 'test'"):
        SubClassVarArgs.load_from_checkpoint(raw_checkpoint_path)
Test for inheritance: super class takes positional arg, subclass takes varargs.
tests/tests_pytorch/models/test_hparams.py