def test_layer_instance_with_config_as_activation(self):
        """
        Tests serialization when activation is a Layer instance with config.
        """

        # Conv1D layer with LeakyReLU layer (with config) as activation
        leaky_activation = keras.layers.LeakyReLU(
            negative_slope=0.15, name="my_leaky"
        )
        layer_conv_leaky = keras.layers.Conv1D(
            filters=2, kernel_size=3, activation=leaky_activation
        )
        # Build the layer
        layer_conv_leaky.build(input_shape=(None, 10, 4))
        _, restored_conv_leaky, _ = self.roundtrip(layer_conv_leaky)

        # Verify the activation is correctly deserialized as LeakyReLU
        self.assertIsInstance(
            restored_conv_leaky.activation, keras.layers.LeakyReLU
        )
        # Verify configuration of the activation layer is preserved
        self.assertEqual(restored_conv_leaky.activation.negative_slope, 0.15)
        self.assertEqual(restored_conv_leaky.activation.name, "my_leaky")

        Tests serialization when activation is a Layer instance with config.
        
keras/src/saving/serialization_lib_test.py