def test_dataclass_lightning_module(tmp_path):
    """Test that save_hyperparameters() works with a LightningModule as a dataclass."""
    model = DataClassModel(33, optional="cocofruit")
    assert model.hparams == {"mandatory": 33, "optional": "cocofruit"}
Test that save_hyperparameters() works with a LightningModule as a dataclass.
tests/tests_pytorch/models/test_hparams.py