code: def test_sample_polytope_with_eq_constraints(self):
      for dtype in (torch.float, torch.double):
          A = self.A.to(dtype)
          b = self.b.to(dtype)
          x0 = self.x0.to(dtype)
          bounds = self.bounds.to(dtype)
          C = torch.tensor(
              [[1.0, -1, 0.0]], device=self.device, dtype=dtype
          )
          d = torch.zeros(1, 1, device=self.device, dtype=dtype)
  
          for interior_point in [x0, None]:
              sampler = self.sampler_class(
                  inequality_constraints=(A, b),
                  equality_constraints=(C, d),
                  bounds=bounds,
                  interior_point=interior_point,
                  **self.sampler_kwargs,
              )
              samples = sampler.draw(n=10, seed=1)
              inequality_satisfied = (
                  (A @ samples.t() - b) > 0
              ).sum().item() == 0
              equality_satisfied = (
                  C @ samples.t() - d
              ).abs().sum().item() < 1e-6
              self.assertTrue(inequality_satisfied)
              self.assertTrue(equality_satisfied)
              self.assertTrue((samples <= bounds[1]).all())
              self.assertTrue((samples >= bounds[0]).all())
              # test no inequality constraints
              sampler = self.sampler_class(
                  equality_constraints=(C, d),
                  bounds=bounds,
                  interior_point=interior_point,
                  **self.sampler_kwargs,
              )
              samples = sampler.draw(n=10, seed=1)
              equality_satisfied = (
                  C @ samples.t() - d
              ).abs().sum().item() < 1e-6
              self.assertTrue(equality_satisfied)
              self.assertTrue((samples <= bounds[1]).all())
              self.assertTrue((samples >= bounds[0]).all())
              # test no inequality constraints or bounds
              with self.assertRaises(BotorchError):
                  self.sampler_class(
                      equality_constraints=(C, d),
                      interior_point=interior_point,
                      **self.sampler_kwargs,
                  )
  
imports: from __future__ import annotations
  import itertools
  import warnings
  from typing import Any, Dict, Type
  from unittest import mock
  import numpy
  import torch
  from botorch.exceptions.errors import BotorchError
  from botorch.models.gp_regression import SingleTaskGP
  from botorch.sampling.pathwise import draw_matheron_paths
  from botorch.utils.sampling import _convert_bounds_to_inequality_constraints, batched_multinomial, DelaunayPolytopeSampler, draw_sobol_samples, find_interior_point, get_polytope_samples, HitAndRunPolytopeSampler, manual_seed, normalize_linear_constraints, optimize_posterior_samples, PolytopeSampler, sample_hypersphere, sample_simplex, sparse_to_dense_constraints
  from botorch.utils.testing import BotorchTestCase
label_desc: Use image node_id 4 for calling the PolytopeSamplerTestBase obj's underlying member method code with example usage: obj.test_sample_polytope_with_eq_constraints() without return types