code: def test_z_dim():
      f = const_vel_filter(1.0, x0=2, R_std=1.0, Q_var=5.1)
      f.test_matrix_dimensions()
      f.update(3.0)
      assert f.x.shape == (2,)
  
      f.update([3])
      assert f.x.shape == (2,)
  
      f.update(np.array([[3]]))
      assert f.x.shape == (2,)
  
      try:
          f.update(np.array([[[3]]]))
          assert (
              False
          ), "filter should have asserted that [[[3]]] is not a valid form for z"
      except:
          pass
  
      f = const_vel_filter_2d(1.0, R_std=1.0, Q_var=5.1)
      try:
          f.update(3)
          assert (
              False
          ), "filter should have asserted that 3 is not a valid form for z"
      except:
          pass
  
      try:
          f.update([3])
          assert (
              False
          ), "filter should have asserted that [3] is not a valid form for z"
      except:
          pass
  
      try:
          f.update([3, 3])
          assert (
              False
          ), "filter should have asserted that [3] is not a valid form for z"
      except:
          pass
  
      try:
          f.update([[3, 3]])
          assert (
              False
          ), "filter should have asserted that [3] is not a valid form for z"
      except:
          pass
  
      f = const_vel_filter_2d(1.0, R_std=1.0, Q_var=5.1)
      f.update([[3], [3]])
      f.update(np.array([[3], [3]]))
  
      # now make sure test_matrix_dimensions() is working
  
      f.test_matrix_dimensions()
      try:
          f.H = 3
          f.test_matrix_dimensions()
          assert (
              False
          ), "test_matrix_dimensions should have asserted on shape of H"
      except:
          pass
  
      f = const_vel_filter_2d(1.0, R_std=1.0, Q_var=5.1)
      try:
          f.R = 3
          f.test_matrix_dimensions()
          assert (
              False
          ), "test_matrix_dimensions should have asserted on shape of R"
      except:
          pass
  
      try:
          f.R = [3]
          f.test_matrix_dimensions()
          assert (
              False
          ), "test_matrix_dimensions should have asserted on shape of R"
      except:
          pass
  
      try:
          f.R = [3, 4.0]
          f.test_matrix_dimensions()
          assert (
              False
          ), "test_matrix_dimensions should have asserted on shape of R"
      except:
          pass
  
      f.R = np.diag([3, 4.0])
      f.test_matrix_dimensions()
  
      f = const_vel_filter(1.0, x0=2, R_std=1.0, Q_var=5.1)
  
      # test case where x is 1d array
      f.update([[3]])
      f.test_matrix_dimensions(z=3.0)
      f.test_matrix_dimensions(z=[3.0])
  
      # test case whre x is 2d array
      f.x = np.array([[0.0, 0.0]]).T
      f.update([[3]])
      f.test_matrix_dimensions(z=3.0)
      f.test_matrix_dimensions(z=[3.0])
  
      try:
          f.test_matrix_dimensions(z=[[3.0]])
          assert (
              False
          ), "test_matrix_dimensions should have asserted on shape of z"
      except:
          pass
  
      f = const_vel_filter_2d(1.0, R_std=1.0, Q_var=5.1)
  
      # test for 1D value for x, then set to a 2D vector and try again
      for i in range(2):
          try:
              f.test_matrix_dimensions(z=3.0)
              assert (
                  False
              ), "test_matrix_dimensions should have asserted on shape of z"
          except:
              pass
  
          try:
              f.test_matrix_dimensions(z=[3.0])
              assert (
                  False
              ), "test_matrix_dimensions should have asserted on shape of z"
          except:
              pass
  
          try:
              f.test_matrix_dimensions(z=[3.0, 3.0])
              assert (
                  False
              ), "test_matrix_dimensions should have asserted on shape of z"
          except:
              pass
          f.test_matrix_dimensions(z=[[3.0], [3.0]])
          f.x = np.array([[1, 2, 3, 4.0]]).T
  
imports: from __future__ import absolute_import, division, print_function
  import numpy.random
  from numpy.random import randn
  import numpy
  import matplotlib.pyplot
  from pytest import approx
  from filterpy.kalman import KalmanFilter, update, predict, batch_filter
  from filterpy.common import Q_discrete_white_noise, kinematic_kf, Saver
  from filterpy.stats import mahalanobis
  from scipy.linalg import block_diag, norm
label_desc: Use image node_id 14 for calling a global function with example usage: test_z_dim() without return types