code: def test_concatenate(space):
      def assert_type(lhs, rhs, n):
          # Special case: if rhs is a list of scalars, lhs must be an np.ndarray
          if np.isscalar(rhs[0]):
              assert isinstance(lhs, np.ndarray)
              assert all([np.isscalar(rhs[i]) for i in range(n)])
          else:
              assert all(
                  [isinstance(rhs[i], type(lhs)) for i in range(n)]
              )
  
      def assert_nested_equal(lhs, rhs, n):
          assert isinstance(rhs, list)
          assert (n > 0) and (len(rhs) == n)
          assert_type(lhs, rhs, n)
          if isinstance(lhs, np.ndarray):
              assert lhs.shape[0] == n
              for i in range(n):
                  assert np.all(lhs[i] == rhs[i])
  
          elif isinstance(lhs, tuple):
              for i in range(len(lhs)):
                  rhs_T_i = [rhs[j][i] for j in range(n)]
                  assert_nested_equal(lhs[i], rhs_T_i, n)
  
          elif isinstance(lhs, OrderedDict):
              for key in lhs.keys():
                  rhs_T_key = [rhs[j][key] for j in range(n)]
                  assert_nested_equal(lhs[key], rhs_T_key, n)
  
          else:
              raise TypeError(f"Got unknown type `{type(lhs)}`.")
  
      samples = [space.sample() for _ in range(8)]
      array = create_empty_array(space, n=8)
      concatenated = concatenate(space, samples, array)
  
      assert np.all(concatenated == array)
      assert_nested_equal(array, samples, n=8)
  
file_path: gym/tests/vector/test_numpy_utils.py
imports: from collections import OrderedDict
  import numpy
  import pytest
  from gym.spaces import Dict, Tuple
  from gym.vector.utils.numpy_utils import concatenate, create_empty_array
  from gym.vector.utils.spaces import BaseGymSpaces
  from tests.vector.utils import spaces
label_desc: Use image node_id 1 for calling a global function with example usage: test_concatenate(space) without return types