code: def test_all_constraints_2d(self):
      test_x, test_y = 1, 2
  
      aff_c = AffineWarpConstraints.translation_2d(x=test_x, y=test_y)
      self.assertEqual(
          aff_c.constraints, ((None, None, 1), (None, None, 2))
      )
  
      aff_c = AffineWarpConstraints.scale_2d(x=test_x, y=test_y)
      self.assertEqual(
          aff_c.constraints, ((1, None, None), (None, 2, None))
      )
  
      aff_c = AffineWarpConstraints.shear_2d(x=test_x, y=test_y)
      self.assertEqual(
          aff_c.constraints, ((None, 1, None), (2, None, None))
      )
  
      aff_c = AffineWarpConstraints.no_shear_2d()
      self.assertEqual(
          aff_c.constraints, ((None, 0, None), (0, None, None))
      )
  
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 3 for calling the AffineWarpConstraintsTest obj's underlying member method code with example usage: obj.test_all_constraints_2d() without return types