code: def test_affine_mapping():
      t = tr.MatrixTransform()
      p1 = np.array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]])
  
      # test pure translation
      p2 = p1 + 5.5
      t.set_mapping(p1, p2)
      assert np.allclose(t.map(p1)[:, : p2.shape[1]], p2)
  
      # test pure scaling
      p2 = p1 * 5.5
      t.set_mapping(p1, p2)
      assert np.allclose(t.map(p1)[:, : p2.shape[1]], p2)
  
      # test scale + translate
      p2 = (p1 * 5.5) + 3.5
      t.set_mapping(p1, p2)
      assert np.allclose(t.map(p1)[:, : p2.shape[1]], p2)
  
      # test SRT
      p2 = np.array([[10, 5, 3], [10, 15, 3], [30, 5, 3], [10, 5, 3.5]])
      t.set_mapping(p1, p2)
      assert np.allclose(t.map(p1)[:, : p2.shape[1]], p2)
  
file_path: vispy/vispy/visuals/transforms/tests/test_transforms.py
imports: import numpy
  from numpy.testing import assert_allclose
  import pytest
  import vispy.visuals.transforms
  from vispy.geometry import Rect
  from vispy.testing import run_tests_if_main
label_desc: Use image node_id 8 for calling a global function with example usage: test_affine_mapping() without return types