code: def test_init(self, shape, homogeneous):
      coords = self.rng.random(shape)
  
      if homogeneous:
          coords = np.column_stack([coords, np.ones(shape[0])])
  
      points = ps.Pointset(coords, homogeneous=homogeneous)
      assert np.allclose(points.affine, np.eye(shape[1] + 1))
      assert points.homogeneous is homogeneous
      assert (points.n_coords, points.dim) == shape
  
      points = ps.Pointset(
          coords,
          affine=np.diag([2] * shape[1] + [1]),
          homogeneous=homogeneous,
      )
      assert np.allclose(points.affine, np.diag([2] * shape[1] + [1]))
      assert points.homogeneous is homogeneous
      assert (points.n_coords, points.dim) == shape
  
      # Badly shaped affine
      with pytest.raises(ValueError):
          ps.Pointset(coords, affine=[0, 1])
  
      # Badly valued affine
      with pytest.raises(ValueError):
          ps.Pointset(
              coords, affine=np.ones((shape[1] + 1, shape[1] + 1))
          )
  
imports: from math import prod
  from pathlib import Path
  from unittest import skipUnless
  import numpy
  import pytest
  from nibabel import pointset
  from nibabel.affines import apply_affine
  from nibabel.arrayproxy import ArrayProxy
  from nibabel.fileslice import strided_scalar
  from nibabel.onetime import auto_attr
  from nibabel.optpkg import optional_package
  from nibabel.spatialimages import SpatialImage
  from nibabel.tests.nibabel_data import get_nibabel_data
label_desc: Use image node_id 1 for calling the TestPointsets obj's underlying member method code with example usage: obj.test_init(shape, homogeneous) without return types