def test_variable_repr(self):
        """Test the string representation of a variable."""
        v = backend.Variable(
            initializer=np.array([1.0, 2.0, 3.0], dtype=np.float32),
            name="test_var",
        )
        expected_repr = (
            "<Variable path=test_var, shape=(3,), dtype=float32, "
            "value=[1. 2. 3.]>"
        )
        self.assertEqual(repr(v), expected_repr)

        # Test with `backend.StatelessScope()`
        with backend.StatelessScope():
            v = backend.Variable(
                initializer="zeros", shape=(3,), name="test_var"
            )
            expected_repr = (
                "<Variable path=test_var, shape=(3,), dtype=float32>"
            )
            self.assertEqual(repr(v), expected_repr)
Test the string representation of a variable.
keras/src/backend/common/variables_test.py