code: def test_add_weight_defaults(self):
      class MyLayer(layers.Layer):
          def __init__(self):
              super().__init__()
              self.w1 = self.add_weight()
              self.w2 = self.add_weight(dtype="int32", trainable=False)
              self.w3 = self.add_weight(dtype="bool", trainable=False)
              self.w4 = self.add_weight(
                  dtype="int32", shape=(2, 2), trainable=False
              )
              self.w5 = self.add_weight(
                  initializer="ones", shape=(2, 2)
              )
  
      layer = MyLayer()
      self.assertEqual(layer.w1.shape, ())
      self.assertEqual(layer.w1.dtype, "float32")
  
      self.assertEqual(layer.w2.shape, ())
      self.assertEqual(layer.w2.dtype, "int32")
      self.assertAllClose(backend.convert_to_numpy(layer.w2), 0)
  
      self.assertEqual(layer.w3.shape, ())
      self.assertEqual(layer.w3.dtype, "bool")
      self.assertAllClose(backend.convert_to_numpy(layer.w3), False)
  
      self.assertEqual(layer.w4.shape, (2, 2))
      self.assertEqual(layer.w4.dtype, "int32")
      self.assertAllClose(
          backend.convert_to_numpy(layer.w4), np.zeros((2, 2))
      )
  
      self.assertEqual(layer.w5.shape, (2, 2))
      self.assertEqual(layer.w5.dtype, "float32")
      self.assertAllClose(
          backend.convert_to_numpy(layer.w5), np.ones((2, 2))
      )
  
imports: import numpy
  import pytest
  from keras import backend
  from keras import layers
  from keras import metrics
  from keras import models
  from keras import ops
  from keras import testing
label_desc: Use image node_id 19 for calling the LayerTest obj's underlying member method code with example usage: obj.test_add_weight_defaults() without return types