code: def test_transform(self):
      # transform one document
      doc = list(common_corpus)[0]
      transformed = self.model[doc]
  
      vec = matutils.sparse2full(
          transformed, 2
      )  # convert to dense vector, for easier equality tests
      # The results sometimes differ on Windows, for unknown reasons.
      # See https://github.com/RaRe-Technologies/gensim/pull/2481#issuecomment-549456750
      expected = [0.03028875, 0.96971124]
  
      # must contain the same values, up to re-ordering
      self.assertTrue(
          np.allclose(sorted(vec), sorted(expected), atol=1e-3)
      )
  
      # transform one word
      word = 5
      transformed = self.model.get_term_topics(word)
  
      vec = matutils.sparse2full(transformed, 2)
      expected = [[0.3076869, 0.69231313]]
  
      # must contain the same values, up to re-ordering
      self.assertTrue(
          np.allclose(sorted(vec), sorted(expected), atol=1e-3)
      )
  
imports: import unittest
  import copy
  import logging
  import numbers
  import numpy
  from gensim import matutils
  from gensim.models import nmf
  from gensim.test import basetmtests
  from gensim.test.utils import datapath, get_tmpfile, common_corpus, common_dictionary
label_desc: Use image node_id 5 for calling the TestNmf obj's underlying member method code with example usage: obj.test_transform() without return types