code: def test_random_tt():
      """test for random.random_tt"""
      shape = (10, 11, 12)
      rank = (1, 4, 3, 1)
      true_shapes = [(1, 10, 4), (4, 11, 3), (3, 12, 1)]
  
      factors = random_tt(shape, rank, full=False)
      for i, (true_shape, factor) in enumerate(
          zip(true_shapes, factors)
      ):
          assert_equal(
              factor.shape,
              true_shape,
              err_msg=f"{i}-th factor has shape {factor.shape}, expected {true_shape}",
          )
  
      # Missing a rank
      with np.testing.assert_raises(ValueError):
          shape = (10, 11, 12)
          rank = (1, 3, 1)
          _ = random_tt(shape, rank)
  
      # Not respecting the boundary rank conditions
      with np.testing.assert_raises(ValueError):
          shape = (10, 11, 12)
          rank = (1, 3, 3, 3)
          _ = random_tt(shape, rank)
  
file_path: tensorly/tensorly/random/tests/test_base.py
imports: import numpy
  from numpy.linalg import matrix_rank
  from ...None import backend
  from ..base import random_cp, random_tucker, random_tt, random_tr
  from ...tucker_tensor import tucker_to_tensor
  from ...tenalg import multi_mode_dot
  from ...base import unfold
  from ...testing import assert_equal, assert_array_almost_equal, assert_raises
label_desc: Use image node_id 4 for calling a global function with example usage: test_random_tt() without return types