code: def test_transform(self):
      vectorizer = TfidfVectorizer(norm=None)
      vectorizer.fit(self.docs)
  
      tok2idx = vectorizer.vocab.tok2idx
      idf = vectorizer.idf
      print(vectorizer.vocab.idx2tok)
  
      self.assertEqual(idf[tok2idx["this"], tok2idx["this"]], 1)
      self.assertEqual(
          idf[tok2idx["a"], tok2idx["a"]], np.log(3 / 2) + 1
      )
  
      X = vectorizer.transform(self.docs).A
      npt.assert_array_equal(
          X[:, tok2idx["this"]], np.asarray([1.0, 1.0])
      )
      npt.assert_array_equal(
          X[:, tok2idx["a"]],
          np.asarray([1.0, 0.0]) * (np.log(3 / 2) + 1),
      )
  
      vectorizer.binary = True
      vectorizer.sublinear_tf = True
      X1 = vectorizer.fit_transform(self.docs)
      X2 = vectorizer.transform(self.docs)
      npt.assert_array_equal(X1.A, X2.A)
  
imports: import unittest
  from collections import defaultdict
  import numpy
  import numpy.testing
  from cornac.data import TextModality, ReviewModality
  from cornac.data.text import SPECIAL_TOKENS, DEFAULT_PRE_RULES, BaseTokenizer, Vocabulary, CountVectorizer, TfidfVectorizer
label_desc: Use image node_id 4 for calling the TestTfidfVectorizer obj's underlying member method code with example usage: obj.test_transform() without return types