code: def test_lips_wrapping():
      # Test that shapes touching the edge do not combine by wrapping
      b1 = np.zeros(40, np.int_)
      b1[:11] = 1
      b2 = np.zeros(40, np.int_)
      b2[11:] = 1
      # lines are disjoint
      assert (b1 * b2).sum() == 0
      c = np.indices(b1.shape).astype(np.float64)
      assert_array_equal(intvol.Lips1d(c, b1), (1, 10))
      assert_array_equal(intvol.Lips1d(c, b2), (1, 28))
      assert_array_equal(intvol.Lips1d(c, b1 + b2), (1, 39.0))
      # 2D
      b1 = b1[:, None]
      b2 = b2[:, None]
      # boxes are disjoint
      assert (b1 * b2).sum() == 0
      c = np.indices(b1.shape).astype(np.float64)
      assert_array_equal(intvol.Lips2d(c, b1), (1, 10, 0))
      assert_array_equal(intvol.Lips2d(c, b2), (1, 28, 0))
      assert_array_equal(intvol.Lips2d(c, b1 + b2), (1, 39.0, 0))
      # 3D
      b1 = b1[:, :, None]
      b2 = b2[:, :, None]
      assert b1.shape == (40, 1, 1)
      # boxes are disjoint
      assert (b1 * b2).sum() == 0
      c = np.indices(b1.shape).astype(np.float64)
      assert_array_equal(intvol.Lips3d(c, b1), (1, 10, 0, 0))
      assert_array_equal(intvol.Lips3d(c, b2), (1, 28, 0, 0))
      assert_array_equal(intvol.Lips3d(c, b1 + b2), (1, 39.0, 0, 0))
      # Shapes which are squeezable should still return sensible answers
      # Test simple ones line / box / volume
      for box_shape, exp_ivs in [
          [(10,), (1, 9)],
          [(10, 1), (1, 9, 0)],
          [(1, 10), (1, 9, 0)],
          [(10, 1, 1), (1, 9, 0, 0)],
          [(1, 10, 1), (1, 9, 0, 0)],
          [(1, 1, 10), (1, 9, 0, 0)],
      ]:
          nd = len(box_shape)
          lips_func, ec_func = D_TO_FUNCS[nd]
          c = np.indices(box_shape).astype(np.float64)
          b = np.ones(box_shape, dtype=np.int_)
          assert_array_equal(lips_func(c, b), exp_ivs)
          assert ec_func(b) == exp_ivs[0]
  
imports: from itertools import combinations
  import numpy
  import numpy.linalg
  import pytest
  from numpy.testing import assert_almost_equal, assert_array_equal
  from ..None import intvol
label_desc: Use image node_id 19 for calling a global function with example usage: test_lips_wrapping() without return types