code: def test_embedding_to_matrix(self):
      embedding = {"a": np.array(2), "b": np.array(3), "c": np.array(4)}
      token_index = {"a": 1, "b": 2, "d": 3}
      matrix = embedding_to_matrix(embedding, token_index, 1)
      np.testing.assert_array_equal(matrix[1], np.array(2))
      np.testing.assert_array_equal(matrix[2], np.array(3))
      # random values for zero index and tokens not in embedding
      self.assertTrue(-1 < float(matrix[0]) < 1)
      self.assertTrue(-1 < float(matrix[3]) < 1)
  
file_path: headliner/tests/test_embeddings.py
imports: import os
  import unittest
  import numpy
  from numpy import array
  from numpy.testing import assert_array_equal
  from headliner.embeddings import read_embedding, embedding_to_matrix
label_desc: Use image node_id 2 for calling the TestEmbeddings obj's underlying member method code with example usage: obj.test_embedding_to_matrix() without return types