code: def test_dense_bounds(self):
      # Solutions for comparison are taken from MATLAB.
      lb = np.array([-1, -10])
      ub = np.array([1, 0])
      for lsq_solver in self.lsq_solvers:
          res = lsq_linear(
              A, b, (lb, ub), method=self.method, lsq_solver=lsq_solver
          )
          assert_allclose(res.x, lstsq(A, b, rcond=-1)[0])
  
      lb = np.array([0.0, -np.inf])
      for lsq_solver in self.lsq_solvers:
          res = lsq_linear(
              A,
              b,
              (lb, np.inf),
              method=self.method,
              lsq_solver=lsq_solver,
          )
          assert_allclose(
              res.x, np.array([0.0, -4.084174437334673]), atol=1e-6
          )
  
      lb = np.array([-1, 0])
      for lsq_solver in self.lsq_solvers:
          res = lsq_linear(
              A,
              b,
              (lb, np.inf),
              method=self.method,
              lsq_solver=lsq_solver,
          )
          assert_allclose(
              res.x, np.array([0.448427311733504, 0]), atol=1e-15
          )
  
      ub = np.array([np.inf, -5])
      for lsq_solver in self.lsq_solvers:
          res = lsq_linear(
              A,
              b,
              (-np.inf, ub),
              method=self.method,
              lsq_solver=lsq_solver,
          )
          assert_allclose(res.x, np.array([-0.105560998682388, -5]))
  
      ub = np.array([-1, np.inf])
      for lsq_solver in self.lsq_solvers:
          res = lsq_linear(
              A,
              b,
              (-np.inf, ub),
              method=self.method,
              lsq_solver=lsq_solver,
          )
          assert_allclose(res.x, np.array([-1, -4.181102129483254]))
  
      lb = np.array([0, -4])
      ub = np.array([1, 0])
      for lsq_solver in self.lsq_solvers:
          res = lsq_linear(
              A, b, (lb, ub), method=self.method, lsq_solver=lsq_solver
          )
          assert_allclose(res.x, np.array([0.005236663400791, -4]))
  
imports: import numpy
  from numpy.linalg import lstsq
  from numpy.testing import assert_allclose, assert_equal, assert_
  from scipy.sparse import rand
  from scipy.sparse.linalg import aslinearoperator
  from scipy.optimize import lsq_linear
  import pytest
label_desc: Use image node_id 3 for calling the BaseMixin obj's underlying member method code with example usage: obj.test_dense_bounds() without return types