class_docstr: Test the Ubuntu Corpus trainer class.
class_docstr_tok: ["Test","the","Ubuntu","Corpus","trainer","class","."]
docstr: Create a small tar in a similar format to the
  Ubuntu corpus file in memory for testing.
docstr_tok: ["Create","a","small","tar","in","a","similar","format","to","the","Ubuntu","corpus","file","in","memory","for","testing","."]
code: def _create_test_corpus(self, data):
      """
      Create a small tar in a similar format to the
      Ubuntu corpus file in memory for testing.
      """
      file_path = os.path.join(
          self.trainer.data_directory, "ubuntu_dialogs.tgz"
      )
      tar = tarfile.TarFile(file_path, "w")
  
      tsv1 = BytesIO(data[0])
      tsv2 = BytesIO(data[1])
  
      tarinfo = tarfile.TarInfo("dialogs/3/1.tsv")
      tarinfo.size = len(data[0])
      tar.addfile(tarinfo, fileobj=tsv1)
  
      tarinfo = tarfile.TarInfo("dialogs/3/2.tsv")
      tarinfo.size = len(data[1])
      tar.addfile(tarinfo, fileobj=tsv2)
  
      tsv1.close()
      tsv2.close()
      tar.close()
  
      return file_path
  
imports: from unittest.mock import Mock
  from io import BytesIO
  import tarfile
  import os
  from tests.base_case import ChatBotTestCase
  from chatterbot.trainers import UbuntuCorpusTrainer
label_desc: Use image node_id 5 for calling the UbuntuCorpusTrainerTestCase obj's underlying member method code with example usage: obj._create_test_corpus(data) and returns: file_path