code: def test_generate(self):
      # test task transformation
      gene = DPGenerator(
          trans_methods=["DeleteSubTree"], sub_methods=[]
      )
      for original_samples, trans_rst, trans_type in gene.generate(
          self.dataset
      ):
          self.assertEqual(2, len(original_samples))
          for original_sample, transformed_sample in zip(
              original_samples, trans_rst
          ):
              self.assertTrue(
                  len(original_sample.get_value("x"))
                  != len(transformed_sample.get_value("x"))
              )
  
      trans_methods = ["DeleteSubTree", "Ocr"]
      gene = DPGenerator(trans_methods=trans_methods, sub_methods=[])
      for original_samples, trans_rst, trans_type in gene.generate(
          self.dataset
      ):
          for ori_sample, trans_sample in zip(
              original_samples, trans_rst
          ):
              self.assertTrue(ori_sample != trans_sample)
  
      # test wrong trans_methods
      gene = DPGenerator(
          trans_methods=["wrong_transform_method"], sub_methods=[]
      )
      self.assertRaises(ValueError, next, gene.generate(self.dataset))
      gene = DPGenerator(
          trans_methods=["EntityTyposSwap"], sub_methods=[]
      )
      self.assertRaises(ValueError, next, gene.generate(self.dataset))
      gene = DPGenerator(trans_methods="RemoveSubtree", sub_methods=[])
      self.assertRaises(ValueError, next, gene.generate(self.dataset))
  
      # test part of UT transformations
      gene = DPGenerator(trans_methods=["WordCase"], sub_methods=[])
      for original_samples, trans_rst, trans_type in gene.generate(
          self.dataset
      ):
          self.assertEqual(2, len(original_samples))
          for index in range(len(original_samples)):
              for trans_word, ori_word in zip(
                  trans_rst[index].get_words("x"),
                  original_samples[index].get_words("x"),
              ):
                  self.assertEqual(trans_word, ori_word.upper())
      gene = DPGenerator(trans_methods=["SwapNum"], sub_methods=[])
      for original_samples, trans_rst, trans_type in gene.generate(
          self.dataset
      ):
          for index in range(len(original_samples)):
              for trans_word, ori_word in zip(
                  trans_rst[index].get_words("x"),
                  original_samples[index].get_words("x"),
              ):
                  if ori_word.isdigit():
                      self.assertTrue(ori_word != trans_word)
  
imports: import unittest
  from textflint.input.dataset import Dataset
  from textflint.input.component.sample import DPSample
  from textflint.generation.generator.dp_generator import DPGenerator
label_desc: Use image node_id 1 for calling the TestDPGenerator obj's underlying member method code with example usage: obj.test_generate() without return types