code: def test_dense(self):
      for values in (
          torch.rand(3, 2, dtype=torch.float16),
          torch.rand(5, 4, 3, 2, dtype=torch.float64),
      ):
          event_shape = values.shape[values.ndim // 2 :]
  
          # Test some invalid shapes
          with self.assertRaisesRegex(
              ValueError, "Shape .* incompatible"
          ):
              X = DenseContainer(values=values, event_shape=Size([3]))
  
          with self.assertRaisesRegex(
              ValueError, "Shape .* incompatible"
          ):
              X = DenseContainer(
                  values=values, event_shape=torch.Size([2, 3])
              )
  
          # Test some basic propeties
          X = DenseContainer(values=values, event_shape=event_shape)
          self.assertEqual(X.device, values.device)
          self.assertEqual(X.dtype, values.dtype)
  
          # Test `shape` property
          self.assertEqual(X.shape, values.shape)
  
          # Test `__eq__`
          self.assertEqual(X, DenseContainer(values, event_shape))
          self.assertNotEqual(
              X, DenseContainer(torch.rand_like(values), event_shape)
          )
  
          # Test `__call__`
          self.assertTrue(X().equal(values))
  
file_path: botorch/test/utils/test_containers.py
imports: from dataclasses import dataclass
  from unittest.mock import patch
  import torch
  from botorch.utils.containers import BotorchContainer, DenseContainer, SliceContainer
  from botorch.utils.testing import BotorchTestCase
  from torch import Size
label_desc: Use image node_id 2 for calling the TestContainers obj's underlying member method code with example usage: obj.test_dense() without return types