code: def test_combine_constraints(self):
      test_x, test_y, test_z = 1, 2, 3
      aff_c_1 = AffineWarpConstraints.translation_2d(x=test_x, y=test_y)
      aff_c_2 = AffineWarpConstraints.shear_2d(x=test_x, y=test_y)
      aff_comb = aff_c_1.combine_with(aff_c_2)
      self.assertEqual(
          aff_comb.constraints, ((None, 1, 1), (2, None, 2))
      )
  
      aff_c_1 = AffineWarpConstraints.translation_3d(
          x=test_x, y=test_y, z=test_z
      )
      aff_c_2 = AffineWarpConstraints.no_shear_3d()
      aff_comb = aff_c_1.combine_with(aff_c_2)
      self.assertEqual(
          aff_comb.constraints,
          ((None, 0, 0, 1), (0, None, 0, 2), (0, 0, None, 3)),
      )
  
      aff_c_1 = AffineWarpConstraints.translation_2d(x=test_x, y=test_y)
      aff_c_2 = AffineWarpConstraints.no_shear_3d()
      with self.assertRaisesRegexp(ValueError, ""):
          aff_c_1.combine_with(aff_c_2)
  
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import tensorflow
  from niftynet.layer.grid_warper import AffineGridWarperLayer
  from niftynet.layer.grid_warper import AffineWarpConstraints
  from niftynet.layer.grid_warper import _create_affine_features
  from tests.niftynet_testcase import NiftyNetTestCase
label_desc: Use image node_id 5 for calling the AffineWarpConstraintsTest obj's underlying member method code with example usage: obj.test_combine_constraints() without return types